Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 11 for WithContext (0.34 sec)

  1. gorm.go

    	if config.NowFunc != nil {
    		tx.Config.NowFunc = config.NowFunc
    	}
    
    	if config.Initialized {
    		tx = tx.getInstance()
    	}
    
    	return tx
    }
    
    // WithContext change current instance db's context to ctx
    func (db *DB) WithContext(ctx context.Context) *DB {
    	return db.Session(&Session{Context: ctx})
    }
    
    // Debug start debug mode
    func (db *DB) Debug() (tx *DB) {
    	tx = db.getInstance()
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Sun Aug 20 11:46:56 GMT 2023
    - 11.6K bytes
    - Viewed (0)
  2. istioctl/pkg/wait/wait.go

    			ctx, cancel := context.WithTimeout(context.Background(), timeout)
    			defer cancel()
    			if generation == "" {
    				w = getAndWatchResource(ctx, cliCtx) // setup version getter from kubernetes
    			} else {
    				w = withContext(ctx)
    				w.Go(func(result chan string) error {
    					result <- generation
    					return nil
    				})
    			}
    			// wait for all deployed versions to be contained in generations
    			t := time.NewTicker(pollInterval)
    Go
    - Registered: Wed May 01 22:53:12 GMT 2024
    - Last Modified: Sat Feb 17 12:24:17 GMT 2024
    - 10.1K bytes
    - Viewed (0)
  3. internal/rest/rpc-stats.go

    		},
    		ConnectDone: func(network, addr string, err error) {
    			if err == nil {
    				atomic.StoreInt64(&dialEnd, time.Now().UnixNano())
    			}
    		},
    	}
    
    	return req.WithContext(httptrace.WithClientTrace(req.Context(), trace)), func() {
    		if ds := atomic.LoadInt64(&dialStart); ds > 0 {
    			if de := atomic.LoadInt64(&dialEnd); de == 0 {
    				atomic.AddUint64(&globalStats.tcpDialErrs, 1)
    Go
    - Registered: Sun Apr 21 19:28:08 GMT 2024
    - Last Modified: Thu Sep 29 16:27:58 GMT 2022
    - 2.3K bytes
    - Viewed (0)
  4. tests/prepared_stmt_test.go

    		t.Fatalf("should assign PreparedStatement Manager back to database when using PrepareStmt mode")
    	}
    
    	ctx, cancel := context.WithTimeout(context.Background(), 500*time.Millisecond)
    	defer cancel()
    	txCtx := tx.WithContext(ctx)
    
    	user := *GetUser("prepared_stmt", Config{})
    
    	txCtx.Create(&user)
    
    	var result1 User
    	if err := txCtx.Find(&result1, user.ID).Error; err != nil {
    		t.Fatalf("no error should happen but got %v", err)
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Thu Mar 21 07:55:43 GMT 2024
    - 4K bytes
    - Viewed (0)
  5. internal/event/target/elasticsearch.go

    	resp, err := c.Ping(
    		c.Ping.WithContext(ctx),
    	)
    	if err != nil {
    		return false, store.ErrNotConnected
    	}
    	xhttp.DrainBody(resp.Body)
    	return !resp.IsError(), nil
    }
    
    func (c *esClientV7) entryExists(ctx context.Context, index string, key string) (bool, error) {
    	res, err := c.Exists(
    		index,
    		key,
    		c.Exists.WithContext(ctx),
    	)
    	if err != nil {
    		return false, err
    	}
    Go
    - Registered: Sun Apr 28 19:28:10 GMT 2024
    - Last Modified: Thu Jan 18 07:03:17 GMT 2024
    - 15K bytes
    - Viewed (0)
  6. internal/handlers/forwarder.go

    	outReq.ProtoMajor = 1
    	outReq.ProtoMinor = 1
    
    	f.rewriter.Rewrite(outReq)
    
    	// Disable closeNotify when method GET for http pipelining
    	if outReq.Method == http.MethodGet {
    		quietReq := outReq.WithContext(context.Background())
    		*outReq = *quietReq
    	}
    }
    
    // headerRewriter is responsible for removing hop-by-hop headers and setting forwarding headers
    type headerRewriter struct{}
    
    Go
    - Registered: Sun Apr 21 19:28:08 GMT 2024
    - Last Modified: Fri Apr 07 05:42:10 GMT 2023
    - 5.6K bytes
    - Viewed (0)
  7. internal/rest/client.go

    		Method:     http.MethodPost,
    		URL:        &u,
    		Proto:      "HTTP/1.1",
    		ProtoMajor: 1,
    		ProtoMinor: 1,
    		Header:     make(http.Header),
    		Body:       rc,
    		Host:       u.Host,
    	}
    	req = req.WithContext(ctx)
    	if body != nil {
    		switch v := body.(type) {
    		case *bytes.Buffer:
    			req.ContentLength = int64(v.Len())
    			buf := v.Bytes()
    			req.GetBody = func() (io.ReadCloser, error) {
    Go
    - Registered: Sun Apr 21 19:28:08 GMT 2024
    - Last Modified: Thu Apr 04 12:04:40 GMT 2024
    - 14K bytes
    - Viewed (0)
  8. tests/transaction_test.go

    func TestCancelTransaction(t *testing.T) {
    	ctx := context.Background()
    	ctx, cancelFunc := context.WithCancel(ctx)
    	cancelFunc()
    
    	user := *GetUser("cancel_transaction", Config{})
    	DB.Create(&user)
    
    	err := DB.WithContext(ctx).Transaction(func(tx *gorm.DB) error {
    		var result User
    		tx.First(&result, user.ID)
    		return nil
    	})
    
    	if err == nil {
    		t.Fatalf("Transaction should get error when using cancelled context")
    	}
    }
    
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Sat Jun 10 13:05:19 GMT 2023
    - 10.9K bytes
    - Viewed (0)
  9. tests/scopes_test.go

    	}).Find(&users1)
    
    	if result.RowsAffected != 2 {
    		t.Errorf("Should found two users's name in 1, 2, but got %v", result.RowsAffected)
    	}
    
    	var maxId int64
    	userTable := func(db *gorm.DB) *gorm.DB {
    		return db.WithContext(context.Background()).Table("users")
    	}
    	if err := DB.Scopes(userTable).Select("max(id)").Scan(&maxId).Error; err != nil {
    		t.Errorf("select max(id)")
    	}
    }
    
    func TestComplexScopes(t *testing.T) {
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Fri Jan 12 08:42:21 GMT 2024
    - 3.3K bytes
    - Viewed (0)
  10. cmd/http-tracer.go

    		tc := mcontext.TraceCtxt{
    			AmzReqID:         w.Header().Get(xhttp.AmzRequestID),
    			RequestRecorder:  reqRecorder,
    			ResponseRecorder: respRecorder,
    		}
    
    		r = r.WithContext(context.WithValue(r.Context(), mcontext.ContextTraceKey, &tc))
    
    		reqStartTime := time.Now().UTC()
    		h.ServeHTTP(respRecorder, r)
    		reqEndTime := time.Now().UTC()
    
    Go
    - Registered: Sun Apr 28 19:28:10 GMT 2024
    - Last Modified: Tue Nov 21 01:09:35 GMT 2023
    - 5.9K bytes
    - Viewed (0)
Back to top