Documentation
¶
Index ¶
- Variables
- func DbMeasureQuerySince(query string, start time.Time)
- func DbMeasureSince(start time.Time)
- type Provider
- func (p *Provider) BeginTx(ctx context.Context, opts *sql.TxOptions) (xdb.Provider, error)
- func (p *Provider) Builder() xsql.SQLDialect
- func (p *Provider) CheckErrIDConflict(ctx context.Context, err error, id uint64)
- func (p *Provider) Close() (err error)
- func (p *Provider) Commit() error
- func (p *Provider) ConnectionString() string
- func (p *Provider) DB() xdb.DB
- func (p *Provider) ExecContext(ctx context.Context, query string, args ...any) (sql.Result, error)
- func (p *Provider) IDTime(id uint64) time.Time
- func (p *Provider) Name() string
- func (p *Provider) NextID() xdb.ID
- func (p *Provider) QueryContext(ctx context.Context, query string, args ...any) (*sql.Rows, error)
- func (p *Provider) QueryRowContext(ctx context.Context, query string, args ...any) *sql.Row
- func (p *Provider) Rollback() error
- func (p *Provider) Tx() xdb.Tx
Constants ¶
This section is empty.
Variables ¶
var DbSlowMethodMilliseconds = 500
DbSlowMethodMilliseconds defines the maximum number of Milliseconds to define a DB operation slow
Functions ¶
func DbMeasureQuerySince ¶
DbMeasureQuerySince emit DB operation perf, and logs a Warning for slow operations
func DbMeasureSince ¶
DbMeasureSince emit DB operation perf, and logs a Warning for slow operations
Types ¶
type Provider ¶
type Provider struct {
// contains filtered or unexported fields
}
Provider represents SQL client instance
func (*Provider) BeginTx ¶
BeginTx starts a transaction.
The provided context is used until the transaction is committed or rolled back. If the context is cancelled, the sql package will roll back the transaction. Tx.Commit will return an error if the context provided to BeginTx is cancelled.
The provided TxOptions is optional and may be nil if defaults should be used. If a non-default isolation level is used that the driver doesn't support, an error will be returned.
func (*Provider) CheckErrIDConflict ¶
CheckErrIDConflict prints decomposed ID if error is ID conflict
func (*Provider) ConnectionString ¶
func (*Provider) ExecContext ¶
ExecContext executes a query without returning any rows. The args are for any placeholder parameters in the query.
func (*Provider) QueryContext ¶
QueryContext executes a query that returns rows, typically a SELECT. The args are for any placeholder parameters in the query.
func (*Provider) QueryRowContext ¶
QueryRowContext executes a query that is expected to return at most one row. QueryRowContext always returns a non-nil value. Errors are deferred until Row's Scan method is called. If the query selects no rows, the *Row's Scan will return ErrNoRows. Otherwise, the *Row's Scan scans the first selected row and discards the rest.