Versions in this module Expand all Collapse all v0 v0.2.0 Feb 20, 2019 Changes in this version + var DefaultLogger = Logger(func(entry *LogEntry) { ... }) + var DollarMarker = OptionFunc(func(db *Database) { ... }) + var ErrNoColumn = core.ErrNoColumn + var ErrNoRows = core.ErrNoRows + var QuestionMarker = OptionFunc(func(db *Database) { ... }) + func BacktickEscape(db *Database) + func DoubleQuoteEscape(db *Database) + func UseArrayInsteadOfJSON(db *Database, b bool) + type ABSTRACT_TYPE string + type AS string + type And []WriterTo + func (ps *And) Append(preds ...interface{}) And + func (ps And) WriteSQLTo(w core.SQLWriter) error + type BeforeInsertInterface interface + BeforeInsert func() error + type BeforeUpdateInterface interface + BeforeUpdate func() error + type ColumnFilter ColumnFilterPtr + func (p *ColumnFilter) Nullable() *ColumnFilter + func (p *ColumnFilter) Optional() *ColumnFilter + func (p *ColumnFilter) WriteSQLTo(w core.SQLWriter) error + type ColumnFilterPtr struct + Column string + IsNil bool + IsZero bool + Prefix string + Value interface{} + func (op *ColumnFilterPtr) Gt() + func (op *ColumnFilterPtr) Gte() + func (op *ColumnFilterPtr) Lt() + func (op *ColumnFilterPtr) Lte() + func (p *ColumnFilterPtr) Nullable() *ColumnFilterPtr + func (p *ColumnFilterPtr) Optional() *ColumnFilterPtr + func (p *ColumnFilterPtr) OptionalNull() *ColumnFilterPtr + func (p *ColumnFilterPtr) OptionalZero() *ColumnFilterPtr + func (p *ColumnFilterPtr) RequiredNull() *ColumnFilterPtr + func (p *ColumnFilterPtr) RequiredZero() *ColumnFilterPtr + func (p *ColumnFilterPtr) WriteSQLTo(w core.SQLWriter) error + type CommonQuery = core.CommonQuery + type DBInterface = core.DBInterface + type DEL int + type Database struct + func Connect(driver, connStr string, opts ...Option) (*Database, error) + func MustConnect(driver, connStr string, opts ...Option) *Database + func (db *Database) Apply(funcs ...func(CommonQuery)) Query + func (db *Database) Begin() (Tx, error) + func (db *Database) BeginContext(ctx context.Context) (Tx, error) + func (db *Database) Count(obj core.ITableName, preds ...interface{}) (uint64, error) + func (db *Database) DB() *sql.DB + func (db *Database) Delete(obj core.ITableName) (int64, error) + func (db *Database) Exec(query string, args ...interface{}) (_ sql.Result, err error) + func (db *Database) ExecContext(ctx context.Context, query string, args ...interface{}) (_ sql.Result, err error) + func (db *Database) Exists(column string, exists bool) Query + func (db *Database) Find(objs core.IFind, preds ...interface{}) error + func (db *Database) From(table string) Query + func (db *Database) Get(obj core.IGet, preds ...interface{}) (bool, error) + func (db *Database) GroupBy(groupBys ...string) Query + func (db *Database) In(column string, args ...interface{}) Query + func (db *Database) Insert(objs ...core.IInsert) (int64, error) + func (db *Database) IsNull(column string, null bool) Query + func (db *Database) Limit(limit uint64) Query + func (db *Database) MustExec(query string, args ...interface{}) sql.Result + func (db *Database) NewQuery() Query + func (db *Database) NotIn(column string, args ...interface{}) Query + func (db *Database) Offset(offset uint64) Query + func (db *Database) Opts() core.Opts + func (db *Database) OrderBy(orderBys ...string) Query + func (db *Database) Prefix(sql string, args ...interface{}) Query + func (db *Database) Preload(table string, preds ...interface{}) Query + func (db *Database) Query(query string, args ...interface{}) (_ *sql.Rows, err error) + func (db *Database) QueryContext(ctx context.Context, query string, args ...interface{}) (_ *sql.Rows, err error) + func (db *Database) QueryRow(query string, args ...interface{}) Row + func (db *Database) QueryRowContext(ctx context.Context, query string, args ...interface{}) Row + func (db *Database) SQL(args ...interface{}) Query + func (db *Database) Select(cols ...string) Query + func (db *Database) Suffix(sql string, args ...interface{}) Query + func (db *Database) Table(sql string) Query + func (db *Database) Update(objs ...core.IUpdate) (int64, error) + func (db *Database) UpdateAll() Query + func (db *Database) UpdateMap(m map[string]interface{}) (int64, error) + func (db *Database) Where(args ...interface{}) Query + type DynamicLogger struct + func NewDynamicLogger(logger Logger) *DynamicLogger + func (d *DynamicLogger) SQLOption(db *Database) + func (d *DynamicLogger) SetLogger(logger Logger) + type Error = core.Error + type ErrorMapper func(error, *LogEntry) error + func (m ErrorMapper) SQLOption(db *Database) + type Expr struct + Args []interface{} + SQL []byte + func (e Expr) WriteSQLTo(w core.SQLWriter) error + type ExprString struct + Args []interface{} + SQL string + func (e ExprString) WriteSQLTo(w core.SQLWriter) error + type FilterMode int + const ModeDefault + const ModeNullable + const ModeOptional + const ModeOptionalNull + const ModeOptionalZero + const ModeRequiredNull + const ModeRequiredZero + type Flags uint + func (f Flags) IsBuild() bool + func (f Flags) IsQuery() bool + func (f Flags) IsTx() bool + func (f Flags) MarshalJSON() ([]byte, error) + func (f Flags) Type() Type + type INS int + type InPart struct + func (p InPart) WriteSQLTo(w core.SQLWriter) error + type InsPart struct + func (p InsPart) WriteSQLTo(w core.SQLWriter) error + type IsNullPart struct + func (p IsNullPart) WriteSQLTo(w core.SQLWriter) error + type JOIN_TYPE = core.JoinType + const CROSS_JOIN + const FULL_JOIN + const JOIN + const LEFT_JOIN + const NATURAL_JOIN + const RIGHT_JOIN + const SELF_JOIN + type LogArgs []interface + func (args LogArgs) MarshalJSON() ([]byte, error) + func (args LogArgs) ToSQLValues() (res []interface{}, _err error) + type LogEntry struct + Args LogArgs + Ctx context.Context + Duration time.Duration + Error error + OrigError error + Query string + Time time.Time + TxQueries []*LogEntry + type Logger func(*LogEntry) + func (l Logger) SQLOption(db *Database) + type ON string + type Once []WriterTo + func (ps Once) WriteSQLTo(w core.SQLWriter) error + type Option interface + SQLOption func(*Database) + func SetErrorMapper(mapper ErrorMapper) Option + func SetLogger(logger Logger) Option + type OptionFunc func(*Database) + func (fn OptionFunc) SQLOption(db *Database) + type Or []WriterTo + func (ps *Or) Append(preds ...interface{}) Or + func (ps Or) WriteSQLTo(w core.SQLWriter) error + type Parts []WriterTo + func (ps *Parts) Append(preds ...interface{}) Parts + func (ps Parts) WriteSQLTo(w core.SQLWriter, sep string) error + type PoolConfig struct + MaxIdle int + MaxLifetime time.Duration + MaxOpen int + func (cfg PoolConfig) SQLOption(db *Database) + type Query = core.Query + type Row = core.Row + type SEL int + type SQLWriter = core.SQLWriter + type TABLE string + type Tx interface + Commit func() error + Rollback func() error + type Type int + const FlagBuild + const FlagTx + const TypeCommit + const TypeExec + const TypeQuery + const TypeQueryRow + const TypeRollback + type UPD int + type Writer struct + func NewWriter(opts core.Opts, quote byte, marker byte, size int) *Writer + func (w *Writer) Args() []interface{} + func (w *Writer) Len() int + func (w *Writer) Opts() core.Opts + func (w *Writer) ScanArgs() []interface{} + func (w *Writer) String() string + func (w *Writer) TrimLast(n int) + func (w *Writer) WriteArg(arg interface{}) + func (w *Writer) WriteArgs(args []interface{}) + func (w *Writer) WriteByte(b byte) + func (w *Writer) WriteMarker() + func (w *Writer) WriteMarkers(n int) + func (w *Writer) WriteName(name string) + func (w *Writer) WritePrefixedName(schema, name string) + func (w *Writer) WriteQuery(query []byte) + func (w *Writer) WriteQueryName(name string) + func (w *Writer) WriteQueryString(query string) + func (w *Writer) WriteQueryStringWithPrefix(prefix, query string) + func (w *Writer) WriteRaw(query []byte) + func (w *Writer) WriteRawString(query string) + func (w *Writer) WriteScanArg(arg interface{}) + func (w *Writer) WriteScanArgs(args []interface{}) + type WriterTo interface + WriteSQLTo func(w core.SQLWriter) error + func Filter(prefix, pred string, args ...interface{}) WriterTo + func In(column string, args ...interface{}) WriterTo + func Ins(columns []string, args ...interface{}) WriterTo + func NewExpr(preds ...interface{}) WriterTo + func NewInPart(in bool, column string, args ...interface{}) WriterTo + func NewInsPart(in bool, columns []string, args ...interface{}) WriterTo + func NewIsNullPart(column string, null bool) WriterTo + func NotIn(column string, args ...interface{}) WriterTo + func NotIns(columns []string, args ...interface{}) WriterTo + type WriterToFunc func(w core.SQLWriter) error + func (fn WriterToFunc) WriteSQLTo(w core.SQLWriter) error