Documentation ¶
Index ¶
- func RunMigrations(config Config, embeddedMigrations embed.FS, resourcePath string) error
- func RunRollback(config Config, embeddedMigrations embed.FS, resourcePath string) error
- func WithoutTx(ctx context.Context) context.Context
- type Client
- func (c Client) BeginTx(ctx context.Context, opts *sql.TxOptions) (*sql.Tx, error)
- func (c Client) Close() error
- func (c Client) Commit(ctx context.Context) error
- func (c Client) ExecContext(ctx context.Context, query string, args ...interface{}) (sql.Result, error)
- func (c Client) GetContext(ctx context.Context, dest interface{}, query string, args ...interface{}) error
- func (c Client) GetDB(ctx context.Context) sqlx.ExtContext
- func (c Client) Query(query string, args ...any) (*sql.Rows, error)
- func (c Client) QueryContext(ctx context.Context, query string, args ...interface{}) (*sql.Rows, error)
- func (c Client) QueryRowxContext(ctx context.Context, query string, args ...interface{}) *sqlx.Row
- func (c Client) Rollback(ctx context.Context) error
- func (c Client) SelectContext(ctx context.Context, dest interface{}, query string, args ...interface{}) error
- func (c Client) WithTimeout(ctx context.Context, op func(ctx context.Context) error) (err error)
- func (c Client) WithTransaction(ctx context.Context, txnOptions sql.TxOptions) context.Context
- func (c Client) WithTxn(ctx context.Context, txnOptions sql.TxOptions, txFunc func(*sqlx.Tx) error) (err error)
- type Config
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RunMigrations ¶
func RunRollback ¶
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (Client) ExecContext ¶ added in v0.6.20
func (Client) GetContext ¶ added in v0.6.20
func (Client) QueryContext ¶ added in v0.6.20
func (Client) QueryRowxContext ¶ added in v0.6.20
func (Client) SelectContext ¶ added in v0.6.20
func (Client) WithTimeout ¶
func (Client) WithTransaction ¶ added in v0.6.20
type Config ¶
type Config struct { Driver string `yaml:"driver" mapstructure:"driver"` URL string `yaml:"url" mapstructure:"url"` MaxIdleConns int `yaml:"max_idle_conns" mapstructure:"max_idle_conns" default:"10"` MaxOpenConns int `yaml:"max_open_conns" mapstructure:"max_open_conns" default:"10"` ConnMaxLifeTime time.Duration `yaml:"conn_max_life_time" mapstructure:"conn_max_life_time" default:"10ms"` MaxQueryTimeoutInMS time.Duration `yaml:"max_query_timeout" mapstructure:"max_query_timeout" default:"100ms"` }
Click to show internal directories.
Click to hide internal directories.