Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 2 of 2 for grabConn (0.33 sec)

  1. src/database/sql/sql.go

    	releaseConnOnce sync.Once
    	// releaseConnCache is a cache of c.closemuRUnlockCondReleaseConn
    	// to save allocations in a call to grabConn.
    	releaseConnCache releaseConn
    }
    
    // grabConn takes a context to implement stmtConnGrabber
    // but the context is not used.
    func (c *Conn) grabConn(context.Context) (*driverConn, releaseConn, error) {
    	if c.done.Load() {
    		return nil, nil, ErrConnDone
    	}
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 23 01:16:53 UTC 2024
    - 103.6K bytes
    - Viewed (0)
  2. src/database/sql/sql_test.go

    	}
    	c := new(Conn)
    	ctx := context.Background()
    	n := int(testing.AllocsPerRun(1000, func() {
    		_, release, err := c.grabConn(ctx)
    		if err != nil {
    			t.Fatal(err)
    		}
    		release(nil)
    	}))
    	if n > 0 {
    		t.Fatalf("Conn.grabConn allocated %v objects; want 0", n)
    	}
    }
    
    func BenchmarkGrabConn(b *testing.B) {
    	b.ReportAllocs()
    	c := new(Conn)
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 23 18:42:28 UTC 2024
    - 111.6K bytes
    - Viewed (0)
Back to top