Documentation ¶
Index ¶
- Constants
- Variables
- func Check(ctx context.Context, db *sqlx.DB) (time.Time, error)
- func Migrate(ctx context.Context, db *sqlx.DB) error
- func Open(config Config) (*sqlx.DB, error)
- func Seed(ctx context.Context, db *sqlx.DB) error
- func Str(s string) sql.NullString
- func Time(t time.Time) sql.NullTime
- type Config
- type Entry
- type ErrorMapper
- type ExtContext
- func (ec *ExtContext) BindNamed(query string, args any) (string, []any, error)
- func (ec *ExtContext) DriverName() string
- func (ec *ExtContext) ExecContext(ctx context.Context, query string, args ...any) (sql.Result, error)
- func (ec *ExtContext) QueryContext(ctx context.Context, query string, args ...any) (*sql.Rows, error)
- func (ec *ExtContext) QueryRowxContext(ctx context.Context, query string, args ...any) *sqlx.Row
- func (ec *ExtContext) QueryxContext(ctx context.Context, query string, args ...any) (*sqlx.Rows, error)
- func (ec *ExtContext) Rebind(query string) string
- func (ec *ExtContext) WithErrorMapper(mapper ErrorMapper) *ExtContext
- func (ec *ExtContext) WithLogger(logger *zap.SugaredLogger) *ExtContext
- func (ec *ExtContext) WithMetric(metric Metric) *ExtContext
- type Metric
- type Opt
- type Schema
Constants ¶
View Source
const UniqueViolation = "23505"
UniqueViolation lib/pq errorCodeNames https://github.com/lib/pq/blob/master/error.go#L178
Variables ¶
View Source
var ( ErrNotFound = errors.New("entry not found") ErrNotUnique = errors.New("entry not unique") )
Functions ¶
func Str ¶
func Str(s string) sql.NullString
Types ¶
type ErrorMapper ¶
func NewErrorMapper ¶
func NewErrorMapper() ErrorMapper
type ExtContext ¶
type ExtContext struct {
// contains filtered or unexported fields
}
func NewExtContext ¶
func NewExtContext(extContext sqlx.ExtContext) *ExtContext
func (*ExtContext) DriverName ¶
func (ec *ExtContext) DriverName() string
func (*ExtContext) ExecContext ¶
func (*ExtContext) QueryContext ¶
func (*ExtContext) QueryRowxContext ¶
func (*ExtContext) QueryxContext ¶
func (*ExtContext) Rebind ¶
func (ec *ExtContext) Rebind(query string) string
func (*ExtContext) WithErrorMapper ¶
func (ec *ExtContext) WithErrorMapper(mapper ErrorMapper) *ExtContext
func (*ExtContext) WithLogger ¶
func (ec *ExtContext) WithLogger(logger *zap.SugaredLogger) *ExtContext
func (*ExtContext) WithMetric ¶
func (ec *ExtContext) WithMetric(metric Metric) *ExtContext
type Opt ¶
type Opt func(extContext *ExtContext)
Click to show internal directories.
Click to hide internal directories.