go/src/database/sql/fakedb_test.go

type fakeDriver

type fakeConnector

func (c *fakeConnector) Connect(context.Context) (driver.Conn, error) {}

func (c *fakeConnector) Driver() driver.Driver {}

func (c *fakeConnector) Close() error {}

type fakeDriverCtx

var _

func (cc *fakeDriverCtx) OpenConnector(name string) (driver.Connector, error) {}

type fakeDB

type fakeError

func (err fakeError) Error() string {}

func (err fakeError) Unwrap() error {}

type table

func (t *table) columnIndex(name string) int {}

type row

type memToucher

type fakeConn

func (c *fakeConn) touchMem() {}

func (c *fakeConn) incrStat(v *int) {}

type fakeTx

type boundCol

type fakeStmt

var fdriver

func init() {}

type Dummy

func TestDrivers(t *testing.T) {}

var hookOpenErr

func setHookOpenErr(fn func() error) {}

// Supports dsn forms:
//
//	<dbname>
//	<dbname>;<opts>  (only currently supported option is `badConn`,
//	                  which causes driver.ErrBadConn to be returned on
//	                  every other conn.Begin())
func (d *fakeDriver) Open(dsn string) (driver.Conn, error) {}

func (d *fakeDriver) getDB(name string) *fakeDB {}

func (db *fakeDB) wipe() {}

func (db *fakeDB) createTable(name string, columnNames, columnTypes []string) error {}

// must be called with db.mu lock held
func (db *fakeDB) table(table string) (*table, bool) {}

func (db *fakeDB) columnType(table, column string) (typ string, ok bool) {}

func (c *fakeConn) isBad() bool {}

func (c *fakeConn) isDirtyAndMark() bool {}

func (c *fakeConn) Begin() (driver.Tx, error) {}

var hookPostCloseConn

func setHookpostCloseConn(fn func(*fakeConn, error)) {}

var testStrictClose

// setStrictFakeConnClose sets the t to Errorf on when fakeConn.Close
// fails to close. If nil, the check is disabled.
func setStrictFakeConnClose(t *testing.T) {}

func (c *fakeConn) ResetSession(ctx context.Context) error {}

var _

func (c *fakeConn) IsValid() bool {}

func (c *fakeConn) Close() (err error) {}

func checkSubsetTypes(allowAny bool, args []driver.NamedValue) error {}

func (c *fakeConn) Exec(query string, args []driver.Value) (driver.Result, error) {}

func (c *fakeConn) ExecContext(ctx context.Context, query string, args []driver.NamedValue) (driver.Result, error) {}

func (c *fakeConn) Query(query string, args []driver.Value) (driver.Rows, error) {}

func (c *fakeConn) QueryContext(ctx context.Context, query string, args []driver.NamedValue) (driver.Rows, error) {}

func errf(msg string, args ...any) error {}

// parts are table|selectCol1,selectCol2|whereCol=?,whereCol2=?
// (note that where columns must always contain ? marks,
// just a limitation for fakedb)
func (c *fakeConn) prepareSelect(stmt *fakeStmt, parts []string) (*fakeStmt, error) {}

// parts are table|col=type,col2=type2
func (c *fakeConn) prepareCreate(stmt *fakeStmt, parts []string) (*fakeStmt, error) {}

// parts are table|col=?,col2=val
func (c *fakeConn) prepareInsert(ctx context.Context, stmt *fakeStmt, parts []string) (*fakeStmt, error) {}

var hookPrepareBadConn

func (c *fakeConn) Prepare(query string) (driver.Stmt, error) {}

func (c *fakeConn) PrepareContext(ctx context.Context, query string) (driver.Stmt, error) {}

func (s *fakeStmt) ColumnConverter(idx int) driver.ValueConverter {}

func (s *fakeStmt) Close() error {}

var errClosed

var hookExecBadConn

func (s *fakeStmt) Exec(args []driver.Value) (driver.Result, error) {}

var errFakeConnSessionDirty

func (s *fakeStmt) ExecContext(ctx context.Context, args []driver.NamedValue) (driver.Result, error) {}

func valueFromPlaceholderName(args []driver.NamedValue, name string) driver.Value {}

// When doInsert is true, add the row to the table.
// When doInsert is false do prep-work and error checking, but don't
// actually add the row to the table.
func (s *fakeStmt) execInsert(args []driver.NamedValue, doInsert bool) (driver.Result, error) {}

var hookQueryBadConn

func (s *fakeStmt) Query(args []driver.Value) (driver.Rows, error) {}

func (s *fakeStmt) QueryContext(ctx context.Context, args []driver.NamedValue) (driver.Rows, error) {}

func (s *fakeStmt) NumInput() int {}

var hookCommitBadConn

func (tx *fakeTx) Commit() error {}

var hookRollbackBadConn

func (tx *fakeTx) Rollback() error {}

type rowsCursor

func (rc *rowsCursor) touchMem() {}

func (rc *rowsCursor) Close() error {}

func (rc *rowsCursor) Columns() []string {}

func (rc *rowsCursor) ColumnTypeScanType(index int) reflect.Type {}

var rowsCursorNextHook

func (rc *rowsCursor) Next(dest []driver.Value) error {}

func (rc *rowsCursor) HasNextResultSet() bool {}

func (rc *rowsCursor) NextResultSet() error {}

type fakeDriverString

func (fakeDriverString) ConvertValue(v any) (driver.Value, error) {}

type anyTypeConverter

func (anyTypeConverter) ConvertValue(v any) (driver.Value, error) {}

func converterForType(typ string) driver.ValueConverter {}

func colTypeToReflectType(typ string) reflect.Type {}