Documentation
¶
Overview ¶
NewSqlDb wraps a SqlStore in a stdlib *sql.DB handle. stdlib database/sql pulls reflect through its convert.go Scan path, and the browser GoScript SQL closure never uses the high-level *sql.DB (it reads results through the driver.Rows interface in sdk/sql/query/world); the only caller is the native db/sql/mock helper. Keep this file native-only so reflect stays out of the web build.
Index ¶
- Variables
- func ConvertToNamedValues(values []driver.Value) []driver.NamedValue
- func NewSqlDb(store SqlStore, dsn string) *sql.DB
- type ColumnSchema
- func (m *ColumnSchema) CloneMessageVT() protobuf_go_lite.CloneMessage
- func (m *ColumnSchema) CloneVT() *ColumnSchema
- func (this *ColumnSchema) EqualMessageVT(thatMsg any) bool
- func (this *ColumnSchema) EqualVT(that *ColumnSchema) bool
- func (x *ColumnSchema) GetDatabaseTypeName() string
- func (x *ColumnSchema) GetName() string
- func (x *ColumnSchema) MarshalJSON() ([]byte, error)
- func (x *ColumnSchema) MarshalProtoJSON(s *json.MarshalState)
- func (x *ColumnSchema) MarshalProtoText() string
- func (m *ColumnSchema) MarshalToSizedBufferVT(dAtA []byte) (int, error)
- func (m *ColumnSchema) MarshalToVT(dAtA []byte) (int, error)
- func (m *ColumnSchema) MarshalVT() (dAtA []byte, err error)
- func (*ColumnSchema) ProtoMessage()
- func (x *ColumnSchema) Reset()
- func (m *ColumnSchema) SizeVT() (n int)
- func (x *ColumnSchema) String() string
- func (x *ColumnSchema) UnmarshalJSON(b []byte) error
- func (x *ColumnSchema) UnmarshalProtoJSON(s *json.UnmarshalState)
- func (m *ColumnSchema) UnmarshalVT(dAtA []byte) error
- type Conn
- func (c *Conn) Begin() (driver.Tx, error)deprecated
- func (c *Conn) BeginTx(ctx context.Context, opts driver.TxOptions) (driver.Tx, error)
- func (c *Conn) Close() error
- func (c *Conn) Exec(query string, args []driver.Value) (driver.Result, error)deprecated
- func (c *Conn) ExecContext(ctx context.Context, query string, args []driver.NamedValue) (driver.Result, error)
- func (c *Conn) IsValid() bool
- func (c *Conn) Prepare(query string) (driver.Stmt, error)
- func (c *Conn) Query(query string, args []driver.Value) (driver.Rows, error)deprecated
- func (c *Conn) QueryContext(ctx context.Context, query string, args []driver.NamedValue) (driver.Rows, error)
- func (c *Conn) Release()
- func (c *Conn) ResetSession(ctx context.Context) error
- type ConnStmt
- func (s *ConnStmt) Close() error
- func (s *ConnStmt) Exec(args []driver.Value) (driver.Result, error)deprecated
- func (s *ConnStmt) ExecContext(ctx context.Context, args []driver.NamedValue) (driver.Result, error)
- func (s *ConnStmt) NumInput() int
- func (s *ConnStmt) Query(args []driver.Value) (driver.Rows, error)deprecated
- func (s *ConnStmt) QueryContext(ctx context.Context, args []driver.NamedValue) (driver.Rows, error)
- type ConnTx
- type Controller
- func (c *Controller) Close() error
- func (c *Controller) Execute(ctx context.Context) error
- func (c *Controller) GetControllerInfo() *controller.Info
- func (c *Controller) GetSqlStore(ctx context.Context) (SqlStore, error)
- func (c *Controller) HandleDirective(ctx context.Context, inst directive.Instance) ([]directive.Resolver, error)
- type Driver
- type DriverConnector
- type LookupSqlStore
- type LookupSqlStoreValue
- type Row
- func (m *Row) CloneMessageVT() protobuf_go_lite.CloneMessage
- func (m *Row) CloneVT() *Row
- func (this *Row) EqualMessageVT(thatMsg any) bool
- func (this *Row) EqualVT(that *Row) bool
- func (x *Row) GetValues() []*SqlValue
- func (x *Row) MarshalJSON() ([]byte, error)
- func (x *Row) MarshalProtoJSON(s *json.MarshalState)
- func (x *Row) MarshalProtoText() string
- func (m *Row) MarshalToSizedBufferVT(dAtA []byte) (int, error)
- func (m *Row) MarshalToVT(dAtA []byte) (int, error)
- func (m *Row) MarshalVT() (dAtA []byte, err error)
- func (*Row) ProtoMessage()
- func (x *Row) Reset()
- func (m *Row) SizeVT() (n int)
- func (x *Row) String() string
- func (x *Row) UnmarshalJSON(b []byte) error
- func (x *Row) UnmarshalProtoJSON(s *json.UnmarshalState)
- func (m *Row) UnmarshalVT(dAtA []byte) error
- type RowBatch
- func (m *RowBatch) CloneMessageVT() protobuf_go_lite.CloneMessage
- func (m *RowBatch) CloneVT() *RowBatch
- func (this *RowBatch) EqualMessageVT(thatMsg any) bool
- func (this *RowBatch) EqualVT(that *RowBatch) bool
- func (x *RowBatch) GetRows() []*Row
- func (x *RowBatch) MarshalJSON() ([]byte, error)
- func (x *RowBatch) MarshalProtoJSON(s *json.MarshalState)
- func (x *RowBatch) MarshalProtoText() string
- func (m *RowBatch) MarshalToSizedBufferVT(dAtA []byte) (int, error)
- func (m *RowBatch) MarshalToVT(dAtA []byte) (int, error)
- func (m *RowBatch) MarshalVT() (dAtA []byte, err error)
- func (*RowBatch) ProtoMessage()
- func (x *RowBatch) Reset()
- func (m *RowBatch) SizeVT() (n int)
- func (x *RowBatch) String() string
- func (x *RowBatch) UnmarshalJSON(b []byte) error
- func (x *RowBatch) UnmarshalProtoJSON(s *json.UnmarshalState)
- func (m *RowBatch) UnmarshalVT(dAtA []byte) error
- type SqlConn
- type SqlOps
- type SqlStore
- type SqlTransaction
- type SqlValue
- func (m *SqlValue) CloneMessageVT() protobuf_go_lite.CloneMessage
- func (m *SqlValue) CloneVT() *SqlValue
- func (this *SqlValue) EqualMessageVT(thatMsg any) bool
- func (this *SqlValue) EqualVT(that *SqlValue) bool
- func (x *SqlValue) GetBlobValue() []byte
- func (x *SqlValue) GetFloatValue() float64
- func (x *SqlValue) GetIntValue() int64
- func (x *SqlValue) GetStrValue() string
- func (m *SqlValue) GetValue() isSqlValue_Value
- func (x *SqlValue) MarshalJSON() ([]byte, error)
- func (x *SqlValue) MarshalProtoJSON(s *json.MarshalState)
- func (x *SqlValue) MarshalProtoText() string
- func (m *SqlValue) MarshalToSizedBufferVT(dAtA []byte) (int, error)
- func (m *SqlValue) MarshalToVT(dAtA []byte) (int, error)
- func (m *SqlValue) MarshalVT() (dAtA []byte, err error)
- func (*SqlValue) ProtoMessage()
- func (x *SqlValue) Reset()
- func (m *SqlValue) SizeVT() (n int)
- func (x *SqlValue) String() string
- func (x *SqlValue) UnmarshalJSON(b []byte) error
- func (x *SqlValue) UnmarshalProtoJSON(s *json.UnmarshalState)
- func (m *SqlValue) UnmarshalVT(dAtA []byte) error
- type SqlValue_BlobValue
- func (m *SqlValue_BlobValue) CloneOneofVT() isSqlValue_Value
- func (m *SqlValue_BlobValue) CloneVT() *SqlValue_BlobValue
- func (this *SqlValue_BlobValue) EqualVT(thatIface isSqlValue_Value) bool
- func (m *SqlValue_BlobValue) MarshalToSizedBufferVT(dAtA []byte) (int, error)
- func (m *SqlValue_BlobValue) MarshalToVT(dAtA []byte) (int, error)
- func (m *SqlValue_BlobValue) SizeVT() (n int)
- type SqlValue_FloatValue
- func (m *SqlValue_FloatValue) CloneOneofVT() isSqlValue_Value
- func (m *SqlValue_FloatValue) CloneVT() *SqlValue_FloatValue
- func (this *SqlValue_FloatValue) EqualVT(thatIface isSqlValue_Value) bool
- func (m *SqlValue_FloatValue) MarshalToSizedBufferVT(dAtA []byte) (int, error)
- func (m *SqlValue_FloatValue) MarshalToVT(dAtA []byte) (int, error)
- func (m *SqlValue_FloatValue) SizeVT() (n int)
- type SqlValue_IntValue
- func (m *SqlValue_IntValue) CloneOneofVT() isSqlValue_Value
- func (m *SqlValue_IntValue) CloneVT() *SqlValue_IntValue
- func (this *SqlValue_IntValue) EqualVT(thatIface isSqlValue_Value) bool
- func (m *SqlValue_IntValue) MarshalToSizedBufferVT(dAtA []byte) (int, error)
- func (m *SqlValue_IntValue) MarshalToVT(dAtA []byte) (int, error)
- func (m *SqlValue_IntValue) SizeVT() (n int)
- type SqlValue_StrValue
- func (m *SqlValue_StrValue) CloneOneofVT() isSqlValue_Value
- func (m *SqlValue_StrValue) CloneVT() *SqlValue_StrValue
- func (this *SqlValue_StrValue) EqualVT(thatIface isSqlValue_Value) bool
- func (m *SqlValue_StrValue) MarshalToSizedBufferVT(dAtA []byte) (int, error)
- func (m *SqlValue_StrValue) MarshalToVT(dAtA []byte) (int, error)
- func (m *SqlValue_StrValue) SizeVT() (n int)
Constants ¶
This section is empty.
Variables ¶
var ErrEmptySqlDbId = errors.New("empty sql db id")
ErrEmptySqlDbId is returned if the sql db id is empty.
Functions ¶
func ConvertToNamedValues ¶
func ConvertToNamedValues(values []driver.Value) []driver.NamedValue
ConvertToNamedValues converts the driver.Value slice to a driver.NamedValue slice.
Types ¶
type ColumnSchema ¶ added in v0.52.0
type ColumnSchema struct {
// Name is the column name.
Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
// DatabaseTypeName is the database-specific type name, if known.
DatabaseTypeName string `protobuf:"bytes,2,opt,name=database_type_name,json=databaseTypeName,proto3" json:"databaseTypeName,omitempty"`
// contains filtered or unexported fields
}
ColumnSchema describes one result column.
func (*ColumnSchema) CloneMessageVT ¶ added in v0.52.0
func (m *ColumnSchema) CloneMessageVT() protobuf_go_lite.CloneMessage
func (*ColumnSchema) CloneVT ¶ added in v0.52.0
func (m *ColumnSchema) CloneVT() *ColumnSchema
func (*ColumnSchema) EqualMessageVT ¶ added in v0.52.0
func (this *ColumnSchema) EqualMessageVT(thatMsg any) bool
func (*ColumnSchema) EqualVT ¶ added in v0.52.0
func (this *ColumnSchema) EqualVT(that *ColumnSchema) bool
func (*ColumnSchema) GetDatabaseTypeName ¶ added in v0.52.0
func (x *ColumnSchema) GetDatabaseTypeName() string
func (*ColumnSchema) GetName ¶ added in v0.52.0
func (x *ColumnSchema) GetName() string
func (*ColumnSchema) MarshalJSON ¶ added in v0.52.0
func (x *ColumnSchema) MarshalJSON() ([]byte, error)
MarshalJSON marshals the ColumnSchema to JSON.
func (*ColumnSchema) MarshalProtoJSON ¶ added in v0.52.0
func (x *ColumnSchema) MarshalProtoJSON(s *json.MarshalState)
MarshalProtoJSON marshals the ColumnSchema message to JSON.
func (*ColumnSchema) MarshalProtoText ¶ added in v0.52.0
func (x *ColumnSchema) MarshalProtoText() string
func (*ColumnSchema) MarshalToSizedBufferVT ¶ added in v0.52.0
func (m *ColumnSchema) MarshalToSizedBufferVT(dAtA []byte) (int, error)
func (*ColumnSchema) MarshalToVT ¶ added in v0.52.0
func (m *ColumnSchema) MarshalToVT(dAtA []byte) (int, error)
func (*ColumnSchema) MarshalVT ¶ added in v0.52.0
func (m *ColumnSchema) MarshalVT() (dAtA []byte, err error)
func (*ColumnSchema) ProtoMessage ¶ added in v0.52.0
func (*ColumnSchema) ProtoMessage()
func (*ColumnSchema) Reset ¶ added in v0.52.0
func (x *ColumnSchema) Reset()
func (*ColumnSchema) SizeVT ¶ added in v0.52.0
func (m *ColumnSchema) SizeVT() (n int)
func (*ColumnSchema) String ¶ added in v0.52.0
func (x *ColumnSchema) String() string
func (*ColumnSchema) UnmarshalJSON ¶ added in v0.52.0
func (x *ColumnSchema) UnmarshalJSON(b []byte) error
UnmarshalJSON unmarshals the ColumnSchema from JSON.
func (*ColumnSchema) UnmarshalProtoJSON ¶ added in v0.52.0
func (x *ColumnSchema) UnmarshalProtoJSON(s *json.UnmarshalState)
UnmarshalProtoJSON unmarshals the ColumnSchema message from JSON.
func (*ColumnSchema) UnmarshalVT ¶ added in v0.52.0
func (m *ColumnSchema) UnmarshalVT(dAtA []byte) error
type Conn ¶
type Conn struct {
// contains filtered or unexported fields
}
Conn implements sql/driver.Conn with a SqlStore.
The Conn can service a single query at a time. When starting a new SQL transaction and/or when executing the first statement, the Conn will call SqlStore.NewSqlTransaction to build a SqlTransaction handle.
When rolling back a sql transaction and/or resetting the conn, if non-nil, SqlTransaction.Discard is called to discard the transaction.
Because there can be multiple underlying sql Conn instances as transactions are built and discarded, the database name (USE) must be remembered by Conn.
func (*Conn) BeginTx ¶
BeginTx starts and returns a new transaction. If the context is canceled by the user the sql package will call Tx.Rollback before discarding and closing the connection.
This must check opts.Isolation to determine if there is a set isolation level. If the driver does not support a non-default level and one is set or if there is a non-default isolation level that is not supported, an error must be returned.
This must also check opts.ReadOnly to determine if the read-only value is true to either set the read-only transaction property if supported or return an error if it is not supported.
func (*Conn) Close ¶
Close invalidates and potentially stops any current prepared statements and transactions, marking this connection as no longer in use.
Because the sql package maintains a free pool of connections and only calls Close when there's a surplus of idle connections, it shouldn't be necessary for drivers to do their own connection caching.
Drivers must ensure all network calls made by Close do not block indefinitely (e.g. apply a timeout).
func (*Conn) ExecContext ¶
func (c *Conn) ExecContext(ctx context.Context, query string, args []driver.NamedValue) (driver.Result, error)
ExecContext executes a query in the Exec mode.
func (*Conn) IsValid ¶
IsValid is called prior to placing the connection into the connection pool. The connection will be discarded if false is returned.
type ConnStmt ¶
type ConnStmt struct {
// contains filtered or unexported fields
}
ConnStmt implements driver.Stmt with a Conn. Construct with conn.Prepare.
func (*ConnStmt) Close ¶
Close closes the statement.
As of Go 1.1, a Stmt will not be closed if it's in use by any queries.
Drivers must ensure all network calls made by Close do not block indefinitely (e.g. apply a timeout).
func (*ConnStmt) ExecContext ¶
func (s *ConnStmt) ExecContext(ctx context.Context, args []driver.NamedValue) (driver.Result, error)
ExecContext executes a query that doesn't return rows, such as an INSERT or UPDATE.
ExecContext must honor the context timeout and return when it is canceled.
func (*ConnStmt) NumInput ¶
NumInput returns the number of placeholder parameters.
If NumInput returns >= 0, the sql package will sanity check argument counts from callers and return errors to the caller before the statement's Exec or Query methods are called.
NumInput may also return -1, if the driver doesn't know its number of placeholders. In that case, the sql package will not sanity check Exec or Query argument counts.
func (*ConnStmt) QueryContext ¶
QueryContext executes a query that may return rows, such as a SELECT.
QueryContext must honor the context timeout and return when it is canceled.
type ConnTx ¶
type ConnTx struct {
// contains filtered or unexported fields
}
ConnTx implements driver.Tx attached to a Conn. NOTE: you should use BeginTx to construct this.
type Controller ¶
type Controller struct {
// contains filtered or unexported fields
}
Controller is a common implementation of a SQL engine controller.
func NewController ¶
func NewController( info *controller.Info, dbID string, execute func(ctx context.Context, ctr *ccontainer.CContainer[*SqlStore]) error, ) *Controller
NewController constructs a common SQL engine controller.
func (*Controller) Close ¶
func (c *Controller) Close() error
Close releases any resources used by the controller.
func (*Controller) Execute ¶
func (c *Controller) Execute(ctx context.Context) error
Execute executes the controller.
func (*Controller) GetControllerInfo ¶
func (c *Controller) GetControllerInfo() *controller.Info
GetControllerInfo returns information about the controller.
func (*Controller) GetSqlStore ¶
func (c *Controller) GetSqlStore(ctx context.Context) (SqlStore, error)
GetSqlStore waits for the store to be built.
func (*Controller) HandleDirective ¶
func (c *Controller) HandleDirective( ctx context.Context, inst directive.Instance, ) ([]directive.Resolver, error)
HandleDirective asks if the handler can resolve the directive.
type Driver ¶
type Driver struct {
// contains filtered or unexported fields
}
Driver implements sql.Driver with a common SqlStore.
func NewDriver ¶
NewDriver constructs a new Driver from a SqlStore.
dsn is the default database name string.
func (*Driver) Connect ¶
Connect returns a connection to the database. Connect may return a cached connection (one previously closed), but doing so is unnecessary; the sql package maintains a pool of idle connections for efficient re-use.
The provided context.Context is for dialing purposes only (see net.DialContext) and should not be stored or used for other purposes. A default timeout should still be used when dialing as a connection pool may call Connect asynchronously to any query.
The returned connection is only used by one goroutine at a time.
func (*Driver) Driver ¶
Driver returns the underlying Driver of the Connector, mainly to maintain compatibility with the Driver method on sql.DB.
func (*Driver) Open ¶
Open returns a new connection to the database. The name is a string in a driver-specific format.
Open may return a cached connection (one previously closed), but doing so is unnecessary; the sql package maintains a pool of idle connections for efficient re-use.
The returned connection is only used by one goroutine at a time.
type DriverConnector ¶
type DriverConnector struct {
// contains filtered or unexported fields
}
DriverConnector implements sql.Connector with a Driver.
func NewDriverConnector ¶
func NewDriverConnector(driver *Driver, dsn string) *DriverConnector
NewDriverConnector constructs a new DriverConnector from a SqlStore.
func (*DriverConnector) Connect ¶
Connect returns a connection to the database. Connect may return a cached connection (one previously closed), but doing so is unnecessary; the sql package maintains a pool of idle connections for efficient re-use.
The provided context.Context is for dialing purposes only (see net.DialContext) and should not be stored or used for other purposes. A default timeout should still be used when dialing as a connection pool may call Connect asynchronously to any query.
The returned connection is only used by one goroutine at a time.
func (*DriverConnector) Driver ¶
func (d *DriverConnector) Driver() driver.Driver
Driver returns the underlying Driver of the Connector, mainly to maintain compatibility with the Driver method on sql.DB.
type LookupSqlStore ¶
type LookupSqlStore interface {
// Directive indicates LookupSqlStore is a directive.
directive.Directive
// LookupSqlStoreId returns the sql db id to lookup.
LookupSqlStoreId() string
}
LookupSqlStore is a directive to lookup a SQL store.
func NewLookupSqlStore ¶
func NewLookupSqlStore(dbID string) LookupSqlStore
NewLookupSqlStore constructs a new LookupSqlStore directive.
type LookupSqlStoreValue ¶
type LookupSqlStoreValue = SqlStore
LookupSqlStoreValue is the result type for LookupSqlStore. Multiple results may be pushed to the directive.
func ExLookupSqlStore ¶
func ExLookupSqlStore( ctx context.Context, b bus.Bus, dbID string, returnIfIdle bool, valDisposeCb func(), ) (LookupSqlStoreValue, directive.Instance, directive.Reference, error)
ExLookupSqlStore waits for the sql db to be resolved. if returnIfIdle is set and the directive becomes idle, returns nil, nil, nil,
type Row ¶ added in v0.52.0
type Row struct {
// Values is the row value list.
Values []*SqlValue `protobuf:"bytes,1,rep,name=values,proto3" json:"values,omitempty"`
// contains filtered or unexported fields
}
Row contains SQL values in column order.
func (*Row) CloneMessageVT ¶ added in v0.52.0
func (m *Row) CloneMessageVT() protobuf_go_lite.CloneMessage
func (*Row) EqualMessageVT ¶ added in v0.52.0
func (*Row) MarshalJSON ¶ added in v0.52.0
MarshalJSON marshals the Row to JSON.
func (*Row) MarshalProtoJSON ¶ added in v0.52.0
func (x *Row) MarshalProtoJSON(s *json.MarshalState)
MarshalProtoJSON marshals the Row message to JSON.
func (*Row) MarshalProtoText ¶ added in v0.52.0
func (*Row) MarshalToSizedBufferVT ¶ added in v0.52.0
func (*Row) ProtoMessage ¶ added in v0.52.0
func (*Row) ProtoMessage()
func (*Row) UnmarshalJSON ¶ added in v0.52.0
UnmarshalJSON unmarshals the Row from JSON.
func (*Row) UnmarshalProtoJSON ¶ added in v0.52.0
func (x *Row) UnmarshalProtoJSON(s *json.UnmarshalState)
UnmarshalProtoJSON unmarshals the Row message from JSON.
func (*Row) UnmarshalVT ¶ added in v0.52.0
type RowBatch ¶ added in v0.52.0
type RowBatch struct {
// Rows is the batch of rows.
Rows []*Row `protobuf:"bytes,1,rep,name=rows,proto3" json:"rows,omitempty"`
// contains filtered or unexported fields
}
RowBatch contains a batch of query rows.
func (*RowBatch) CloneMessageVT ¶ added in v0.52.0
func (m *RowBatch) CloneMessageVT() protobuf_go_lite.CloneMessage
func (*RowBatch) EqualMessageVT ¶ added in v0.52.0
func (*RowBatch) MarshalJSON ¶ added in v0.52.0
MarshalJSON marshals the RowBatch to JSON.
func (*RowBatch) MarshalProtoJSON ¶ added in v0.52.0
func (x *RowBatch) MarshalProtoJSON(s *json.MarshalState)
MarshalProtoJSON marshals the RowBatch message to JSON.
func (*RowBatch) MarshalProtoText ¶ added in v0.52.0
func (*RowBatch) MarshalToSizedBufferVT ¶ added in v0.52.0
func (*RowBatch) MarshalToVT ¶ added in v0.52.0
func (*RowBatch) ProtoMessage ¶ added in v0.52.0
func (*RowBatch) ProtoMessage()
func (*RowBatch) UnmarshalJSON ¶ added in v0.52.0
UnmarshalJSON unmarshals the RowBatch from JSON.
func (*RowBatch) UnmarshalProtoJSON ¶ added in v0.52.0
func (x *RowBatch) UnmarshalProtoJSON(s *json.UnmarshalState)
UnmarshalProtoJSON unmarshals the RowBatch message from JSON.
func (*RowBatch) UnmarshalVT ¶ added in v0.52.0
type SqlConn ¶
type SqlConn interface {
driver.Conn
driver.ConnBeginTx
driver.SessionResetter
driver.Validator
driver.ExecerContext
driver.QueryerContext
}
SqlConn is the set of interfaces that Conn implements.
type SqlOps ¶
type SqlOps interface {
driver.Execer //nolint:staticcheck
driver.ExecerContext
driver.Queryer //nolint:staticcheck
driver.QueryerContext
}
SqlOps are operations on the SQL DB transaction.
type SqlStore ¶
type SqlStore interface {
// NewSqlTransaction starts a new SqlStore transaction.
//
// If !write, the transaction should be read-only.
// dsn is the default database name for the transaction.
NewSqlTransaction(
ctx context.Context,
write bool,
dsn string,
) (SqlTransaction, error)
}
SqlStore is a transactional MySQL store.
type SqlTransaction ¶
type SqlTransaction interface {
// Tx is the transaction interface.
tx.Tx
// GetReadOnly returns if the transaction is read-only.
GetReadOnly() bool
// GetSqlOps returns the sql operations interface.
// see the comments in the stdlib sql/driver package for more information.
GetSqlOps(ctx context.Context) (SqlOps, error)
}
SqlTransaction is a SQL DB transaction.
type SqlValue ¶ added in v0.52.0
type SqlValue struct {
// Types that are assignable to Value:
//
// *SqlValue_IntValue
// *SqlValue_FloatValue
// *SqlValue_StrValue
// *SqlValue_BlobValue
Value isSqlValue_Value `protobuf_oneof:"value"`
// contains filtered or unexported fields
}
SqlValue represents a SQL value. If no field in the oneof is set, the value is NULL.
func (*SqlValue) CloneMessageVT ¶ added in v0.52.0
func (m *SqlValue) CloneMessageVT() protobuf_go_lite.CloneMessage
func (*SqlValue) EqualMessageVT ¶ added in v0.52.0
func (*SqlValue) GetBlobValue ¶ added in v0.52.0
func (*SqlValue) GetFloatValue ¶ added in v0.52.0
func (*SqlValue) GetIntValue ¶ added in v0.52.0
func (*SqlValue) GetStrValue ¶ added in v0.52.0
func (*SqlValue) MarshalJSON ¶ added in v0.52.0
MarshalJSON marshals the SqlValue to JSON.
func (*SqlValue) MarshalProtoJSON ¶ added in v0.52.0
func (x *SqlValue) MarshalProtoJSON(s *json.MarshalState)
MarshalProtoJSON marshals the SqlValue message to JSON.
func (*SqlValue) MarshalProtoText ¶ added in v0.52.0
func (*SqlValue) MarshalToSizedBufferVT ¶ added in v0.52.0
func (*SqlValue) MarshalToVT ¶ added in v0.52.0
func (*SqlValue) ProtoMessage ¶ added in v0.52.0
func (*SqlValue) ProtoMessage()
func (*SqlValue) UnmarshalJSON ¶ added in v0.52.0
UnmarshalJSON unmarshals the SqlValue from JSON.
func (*SqlValue) UnmarshalProtoJSON ¶ added in v0.52.0
func (x *SqlValue) UnmarshalProtoJSON(s *json.UnmarshalState)
UnmarshalProtoJSON unmarshals the SqlValue message from JSON.
func (*SqlValue) UnmarshalVT ¶ added in v0.52.0
type SqlValue_BlobValue ¶ added in v0.52.0
type SqlValue_BlobValue struct {
// BlobValue is a byte string value.
BlobValue []byte `protobuf:"bytes,4,opt,name=blob_value,json=blobValue,proto3,oneof"`
}
func (*SqlValue_BlobValue) CloneOneofVT ¶ added in v0.52.0
func (m *SqlValue_BlobValue) CloneOneofVT() isSqlValue_Value
func (*SqlValue_BlobValue) CloneVT ¶ added in v0.52.0
func (m *SqlValue_BlobValue) CloneVT() *SqlValue_BlobValue
func (*SqlValue_BlobValue) EqualVT ¶ added in v0.52.0
func (this *SqlValue_BlobValue) EqualVT(thatIface isSqlValue_Value) bool
func (*SqlValue_BlobValue) MarshalToSizedBufferVT ¶ added in v0.52.0
func (m *SqlValue_BlobValue) MarshalToSizedBufferVT(dAtA []byte) (int, error)
func (*SqlValue_BlobValue) MarshalToVT ¶ added in v0.52.0
func (m *SqlValue_BlobValue) MarshalToVT(dAtA []byte) (int, error)
func (*SqlValue_BlobValue) SizeVT ¶ added in v0.52.0
func (m *SqlValue_BlobValue) SizeVT() (n int)
type SqlValue_FloatValue ¶ added in v0.52.0
type SqlValue_FloatValue struct {
// FloatValue is a double-precision floating point value.
FloatValue float64 `protobuf:"fixed64,2,opt,name=float_value,json=floatValue,proto3,oneof"`
}
func (*SqlValue_FloatValue) CloneOneofVT ¶ added in v0.52.0
func (m *SqlValue_FloatValue) CloneOneofVT() isSqlValue_Value
func (*SqlValue_FloatValue) CloneVT ¶ added in v0.52.0
func (m *SqlValue_FloatValue) CloneVT() *SqlValue_FloatValue
func (*SqlValue_FloatValue) EqualVT ¶ added in v0.52.0
func (this *SqlValue_FloatValue) EqualVT(thatIface isSqlValue_Value) bool
func (*SqlValue_FloatValue) MarshalToSizedBufferVT ¶ added in v0.52.0
func (m *SqlValue_FloatValue) MarshalToSizedBufferVT(dAtA []byte) (int, error)
func (*SqlValue_FloatValue) MarshalToVT ¶ added in v0.52.0
func (m *SqlValue_FloatValue) MarshalToVT(dAtA []byte) (int, error)
func (*SqlValue_FloatValue) SizeVT ¶ added in v0.52.0
func (m *SqlValue_FloatValue) SizeVT() (n int)
type SqlValue_IntValue ¶ added in v0.52.0
type SqlValue_IntValue struct {
// IntValue is a signed integer value.
IntValue int64 `protobuf:"varint,1,opt,name=int_value,json=intValue,proto3,oneof"`
}
func (*SqlValue_IntValue) CloneOneofVT ¶ added in v0.52.0
func (m *SqlValue_IntValue) CloneOneofVT() isSqlValue_Value
func (*SqlValue_IntValue) CloneVT ¶ added in v0.52.0
func (m *SqlValue_IntValue) CloneVT() *SqlValue_IntValue
func (*SqlValue_IntValue) EqualVT ¶ added in v0.52.0
func (this *SqlValue_IntValue) EqualVT(thatIface isSqlValue_Value) bool
func (*SqlValue_IntValue) MarshalToSizedBufferVT ¶ added in v0.52.0
func (m *SqlValue_IntValue) MarshalToSizedBufferVT(dAtA []byte) (int, error)
func (*SqlValue_IntValue) MarshalToVT ¶ added in v0.52.0
func (m *SqlValue_IntValue) MarshalToVT(dAtA []byte) (int, error)
func (*SqlValue_IntValue) SizeVT ¶ added in v0.52.0
func (m *SqlValue_IntValue) SizeVT() (n int)
type SqlValue_StrValue ¶ added in v0.52.0
type SqlValue_StrValue struct {
// StrValue is a string value.
StrValue string `protobuf:"bytes,3,opt,name=str_value,json=strValue,proto3,oneof"`
}
func (*SqlValue_StrValue) CloneOneofVT ¶ added in v0.52.0
func (m *SqlValue_StrValue) CloneOneofVT() isSqlValue_Value
func (*SqlValue_StrValue) CloneVT ¶ added in v0.52.0
func (m *SqlValue_StrValue) CloneVT() *SqlValue_StrValue
func (*SqlValue_StrValue) EqualVT ¶ added in v0.52.0
func (this *SqlValue_StrValue) EqualVT(thatIface isSqlValue_Value) bool
func (*SqlValue_StrValue) MarshalToSizedBufferVT ¶ added in v0.52.0
func (m *SqlValue_StrValue) MarshalToSizedBufferVT(dAtA []byte) (int, error)
func (*SqlValue_StrValue) MarshalToVT ¶ added in v0.52.0
func (m *SqlValue_StrValue) MarshalToVT(dAtA []byte) (int, error)
func (*SqlValue_StrValue) SizeVT ¶ added in v0.52.0
func (m *SqlValue_StrValue) SizeVT() (n int)
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package sql_mock exercises a SqlStore through the stdlib high-level *sql.DB API (sql.Tx, sql.Rows.Scan), which pulls reflect via convert.go.
|
Package sql_mock exercises a SqlStore through the stdlib high-level *sql.DB API (sql.Tx, sql.Rows.Scan), which pulls reflect via convert.go. |
|
gormadapter
Package gormadapter bridges a Mysql transaction to a gorm instance.
|
Package gormadapter bridges a Mysql transaction to a gorm instance. |