Documentation
¶
Index ¶
- func NewMySQLAdapter(dsn string) (thing.DBAdapter, error)
- type MySQLAdapter
- func (a *MySQLAdapter) BeginTx(ctx context.Context, opts *sql.TxOptions) (thing.Tx, error)
- func (a *MySQLAdapter) Builder() thing.SQLBuilder
- func (a *MySQLAdapter) Close() error
- func (a *MySQLAdapter) DB() *sql.DB
- func (a *MySQLAdapter) DialectName() string
- func (a *MySQLAdapter) Exec(ctx context.Context, query string, args ...interface{}) (sql.Result, error)
- func (a *MySQLAdapter) Get(ctx context.Context, dest interface{}, query string, args ...interface{}) error
- func (a *MySQLAdapter) GetCount(ctx context.Context, tableName string, where string, args []interface{}) (int64, error)
- func (a *MySQLAdapter) Select(ctx context.Context, dest interface{}, query string, args ...interface{}) error
- type MySQLDialector
- type MySQLIntrospector
- type MySQLTx
- func (tx *MySQLTx) Commit() error
- func (tx *MySQLTx) Exec(ctx context.Context, query string, args ...interface{}) (sql.Result, error)
- func (tx *MySQLTx) Get(ctx context.Context, dest interface{}, query string, args ...interface{}) error
- func (tx *MySQLTx) Rollback() error
- func (tx *MySQLTx) Select(ctx context.Context, dest interface{}, query string, args ...interface{}) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type MySQLAdapter ¶
type MySQLAdapter struct {
// contains filtered or unexported fields
}
MySQLAdapter implements the DBAdapter interface for MySQL.
func (*MySQLAdapter) Builder ¶
func (a *MySQLAdapter) Builder() thing.SQLBuilder
func (*MySQLAdapter) Close ¶
func (a *MySQLAdapter) Close() error
func (*MySQLAdapter) DB ¶
func (a *MySQLAdapter) DB() *sql.DB
DB returns the underlying *sql.DB for advanced use cases.
func (*MySQLAdapter) DialectName ¶
func (a *MySQLAdapter) DialectName() string
func (*MySQLAdapter) Exec ¶
func (a *MySQLAdapter) Exec(ctx context.Context, query string, args ...interface{}) (sql.Result, error)
Exec executes a query that doesn't return rows (INSERT, UPDATE, DELETE). MySQL uses '?' placeholders.
func (*MySQLAdapter) Get ¶
func (a *MySQLAdapter) Get(ctx context.Context, dest interface{}, query string, args ...interface{}) error
Get retrieves a single row and scans it into the destination struct. Uses QueryContext and prepares scan destinations based on returned columns. MySQL uses '\' placeholders, which is the default for database/sql.
type MySQLDialector ¶
type MySQLDialector struct{}
MySQLDialector implements the sqlbuilder.Dialector interface for MySQL.
func (MySQLDialector) Placeholder ¶
func (d MySQLDialector) Placeholder(_ int) string
func (MySQLDialector) Quote ¶
func (d MySQLDialector) Quote(identifier string) string
type MySQLIntrospector ¶
MySQLIntrospector implements schema.Introspector for MySQL.
func (*MySQLIntrospector) GetTableInfo ¶
func (mi *MySQLIntrospector) GetTableInfo(ctx context.Context, tableName string) (*driversSchema.TableInfo, error)
GetTableInfo introspects the given table and returns its schema info (MySQL).
type MySQLTx ¶
type MySQLTx struct {
// contains filtered or unexported fields
}
MySQLTx implements the Tx interface for MySQL.