Versions in this module Expand all Collapse all v3 v3.1.3 Oct 14, 2020 Changes in this version + var ErrCantConvertToTime = errors.New("dbr: can't convert to time.Time") + var ErrColumnNotSpecified = errors.New("dbr: column not specified") + var ErrInvalidPointer = errors.New("dbr: attempt to load into an invalid pointer") + var ErrInvalidSliceLength = errors.New("dbr: length of slice is 0. length must be >= 1") + var ErrInvalidTimestring = errors.New("dbr: invalid time string") + var ErrNotFound = errors.New("dbr: not found") + var ErrNotSupported = errors.New("dbr: not supported") + var ErrPlaceholderCount = errors.New("dbr: wrong placeholder count") + var ErrPrewhereNotSupported = errors.New("dbr: PREWHERE statement is not supported") + var ErrTableNotSpecified = errors.New("dbr: table not specified") + var Now = nowSentinel + func InterpolateForDialect(query string, value []interface{}, d Dialect) (string, error) + func Load(rows *sql.Rows, value interface{}) (int, error) + func Union(builder ...Builder) interface + func UnionAll(builder ...Builder) interface + type Buffer interface + String func() string + Value func() []interface{} + WriteString func(s string) (n int, err error) + WriteValue func(v ...interface{}) (err error) + func NewBuffer() Buffer + type BuildFunc func(Dialect, Buffer) error + func (b BuildFunc) Build(d Dialect, buf Buffer) error + type Builder interface + Build func(Dialect, Buffer) error + func And(cond ...Builder) Builder + func Eq(column string, value interface{}) Builder + func Expr(query string, value ...interface{}) Builder + func Gt(column string, value interface{}) Builder + func Gte(column string, value interface{}) Builder + func Lt(column string, value interface{}) Builder + func Lte(column string, value interface{}) Builder + func Neq(column string, value interface{}) Builder + func Or(cond ...Builder) Builder + func Proposed(column string) Builder + type ConflictStmt interface + Action func(column string, action interface{}) ConflictStmt + DoNothing func(flag bool) ConflictStmt + type Connection struct + Dialect Dialect + func Open(driver, dsn string, log EventReceiver) (*Connection, error) + func (conn *Connection) NewSession(log EventReceiver) *Session + func (conn *Connection) NewSessionContext(ctx context.Context, log EventReceiver) *Session + type DeleteBuilder interface + Limit func(n uint64) DeleteBuilder + Where func(query interface{}, value ...interface{}) DeleteBuilder + type DeleteStmt interface + Where func(query interface{}, value ...interface{}) DeleteStmt + func DeleteBySql(query string, value ...interface{}) DeleteStmt + func DeleteFrom(table string) DeleteStmt + type Dialect interface + EncodeBool func(b bool) string + EncodeBytes func(b []byte) string + EncodeString func(s string) string + EncodeTime func(t time.Time) string + Limit func(offset, limit int64) string + OnConflict func(constraint string) string + OnConflictDoNothing func(constraint string) string + Placeholder func(n int) string + Prewhere func() string + Proposed func(column string) string + QuoteIdent func(id string) string + type EventReceiver interface + Event func(eventName string) + EventErr func(eventName string, err error) error + EventErrKv func(eventName string, err error, kvs map[string]string) error + EventKv func(eventName string, kvs map[string]string) + Timing func(eventName string, nanoseconds int64) + TimingKv func(eventName string, nanoseconds int64, kvs map[string]string) + type Executer interface + Exec func() (sql.Result, error) + type I string + func (i I) As(alias string) Builder + func (i I) Build(d Dialect, buf Buffer) error + type InsertBuilder interface + Columns func(column ...string) InsertBuilder + OnConflict func(constraint string) ConflictStmt + OnConflictDoNothing func(constraint string) InsertBuilder + OnConflictMap func(constraint string, actions map[string]interface{}) InsertBuilder + Pair func(column string, value interface{}) InsertBuilder + Record func(structValue interface{}) InsertBuilder + Values func(value ...interface{}) InsertBuilder + type InsertStmt interface + Columns func(column ...string) InsertStmt + OnConflict func(constraint string) ConflictStmt + OnConflictDoNothing func(constraint string) InsertStmt + OnConflictMap func(constraint string, actions map[string]interface{}) InsertStmt + Record func(structValue interface{}) InsertStmt + Values func(value ...interface{}) InsertStmt + func InsertBySql(query string, value ...interface{}) InsertStmt + func InsertInto(table string) InsertStmt + type NullBool struct + func NewNullBool(v interface{}) (n NullBool) + func (n *NullBool) UnmarshalJSON(b []byte) error + func (n NullBool) MarshalJSON() ([]byte, error) + type NullEventReceiver struct + func (n *NullEventReceiver) Event(eventName string) + func (n *NullEventReceiver) EventErr(eventName string, err error) error + func (n *NullEventReceiver) EventErrKv(eventName string, err error, kvs map[string]string) error + func (n *NullEventReceiver) EventKv(eventName string, kvs map[string]string) + func (n *NullEventReceiver) Timing(eventName string, nanoseconds int64) + func (n *NullEventReceiver) TimingKv(eventName string, nanoseconds int64, kvs map[string]string) + type NullFloat64 struct + func NewNullFloat64(v interface{}) (n NullFloat64) + func (n *NullFloat64) UnmarshalJSON(b []byte) error + func (n NullFloat64) MarshalJSON() ([]byte, error) + type NullInt64 struct + func NewNullInt64(v interface{}) (n NullInt64) + func (n *NullInt64) UnmarshalJSON(b []byte) error + func (n NullInt64) MarshalJSON() ([]byte, error) + type NullString struct + func NewNullString(v interface{}) (n NullString) + func (n *NullString) UnmarshalJSON(b []byte) error + func (n NullString) MarshalJSON() ([]byte, error) + type NullTime struct + Time time.Time + Valid bool + func NewNullTime(v interface{}) (n NullTime) + func (n *NullTime) Scan(value interface{}) error + func (n *NullTime) UnmarshalJSON(b []byte) error + func (n NullTime) MarshalJSON() ([]byte, error) + func (n NullTime) Value() (driver.Value, error) + type SelectBuilder interface + As func(alias string) Builder + Distinct func() SelectBuilder + ForUpdate func() SelectBuilder + From func(table interface{}) SelectBuilder + FullJoin func(table, on interface{}) SelectBuilder + GroupBy func(col ...string) SelectBuilder + Having func(query interface{}, value ...interface{}) SelectBuilder + InTimezone func(loc *time.Location) SelectBuilder + Join func(table, on interface{}) SelectBuilder + LeftJoin func(table, on interface{}) SelectBuilder + Limit func(n uint64) SelectBuilder + Offset func(n uint64) SelectBuilder + OrderAsc func(col string) SelectStmt + OrderBy func(col string) SelectBuilder + OrderDesc func(col string) SelectStmt + OrderDir func(col string, isAsc bool) SelectBuilder + Paginate func(page, perPage uint64) SelectBuilder + Prewhere func(query interface{}, value ...interface{}) SelectBuilder + RightJoin func(table, on interface{}) SelectBuilder + Where func(query interface{}, value ...interface{}) SelectBuilder + type SelectStmt interface + As func(alias string) Builder + Distinct func() SelectStmt + ForUpdate func() SelectStmt + From func(table interface{}) SelectStmt + FullJoin func(table, on interface{}) SelectStmt + GroupBy func(col ...string) SelectStmt + Having func(query interface{}, value ...interface{}) SelectStmt + Join func(table, on interface{}) SelectStmt + LeftJoin func(table, on interface{}) SelectStmt + Limit func(n uint64) SelectStmt + Offset func(n uint64) SelectStmt + OrderAsc func(col string) SelectStmt + OrderDesc func(col string) SelectStmt + Prewhere func(query interface{}, value ...interface{}) SelectStmt + RightJoin func(table, on interface{}) SelectStmt + Where func(query interface{}, value ...interface{}) SelectStmt + func Select(column ...interface{}) SelectStmt + func SelectBySql(query string, value ...interface{}) SelectStmt + type Session struct + func (sess *Session) Begin() (*Tx, error) + func (sess *Session) BeginWithOpts(opts *sql.TxOptions) (*Tx, error) + func (sess *Session) DeleteBySql(query string, value ...interface{}) DeleteBuilder + func (sess *Session) DeleteFrom(table string) DeleteBuilder + func (sess *Session) Exec(query string, args ...interface{}) (sql.Result, error) + func (sess *Session) InsertBySql(query string, value ...interface{}) InsertBuilder + func (sess *Session) InsertInto(table string) InsertBuilder + func (sess *Session) NewSession(log EventReceiver) *Session + func (sess *Session) Query(query string, args ...interface{}) (*sql.Rows, error) + func (sess *Session) Select(column ...string) SelectBuilder + func (sess *Session) SelectBySql(query string, value ...interface{}) SelectBuilder + func (sess *Session) Update(table string) UpdateBuilder + func (sess *Session) UpdateBySql(query string, value ...interface{}) UpdateBuilder + type SessionRunner interface + DeleteBySql func(query string, value ...interface{}) DeleteBuilder + DeleteFrom func(table string) DeleteBuilder + InsertBySql func(query string, value ...interface{}) InsertBuilder + InsertInto func(table string) InsertBuilder + Select func(column ...string) SelectBuilder + SelectBySql func(query string, value ...interface{}) SelectBuilder + Update func(table string) UpdateBuilder + UpdateBySql func(query string, value ...interface{}) UpdateBuilder + type Tx struct + Dialect Dialect + func (tx *Tx) Commit() error + func (tx *Tx) DeleteBySql(query string, value ...interface{}) DeleteBuilder + func (tx *Tx) DeleteFrom(table string) DeleteBuilder + func (tx *Tx) Exec(query string, args ...interface{}) (sql.Result, error) + func (tx *Tx) InsertBySql(query string, value ...interface{}) InsertBuilder + func (tx *Tx) InsertInto(table string) InsertBuilder + func (tx *Tx) Query(query string, args ...interface{}) (*sql.Rows, error) + func (tx *Tx) Rollback() error + func (tx *Tx) RollbackUnlessCommitted() + func (tx *Tx) Select(column ...string) SelectBuilder + func (tx *Tx) SelectBySql(query string, value ...interface{}) SelectBuilder + func (tx *Tx) Update(table string) UpdateBuilder + func (tx *Tx) UpdateBySql(query string, value ...interface{}) UpdateBuilder + type UpdateBuilder interface + Limit func(n uint64) UpdateBuilder + Set func(column string, value interface{}) UpdateBuilder + SetMap func(m map[string]interface{}) UpdateBuilder + Where func(query interface{}, value ...interface{}) UpdateBuilder + type UpdateStmt interface + Set func(column string, value interface{}) UpdateStmt + SetMap func(m map[string]interface{}) UpdateStmt + Where func(query interface{}, value ...interface{}) UpdateStmt + func Update(table string) UpdateStmt + func UpdateBySql(query string, value ...interface{}) UpdateStmt Other modules containing this package github.com/noil/dbr