Versions in this module Expand all Collapse all v0 v0.0.3 May 5, 2024 v0.0.2 May 5, 2024 v0.0.1 May 5, 2024 Changes in this version + func CopySingletonSlice(result interface{}, rows []interface{}) error + func CopySlice(result interface{}, rows []interface{}) error + type BaseSelectQuery struct + Filter Filter + Options *SelectOptions + Table *Table + func (b *BaseSelectQuery) MakeSelectQuery() (*SelectQuery, error) + type BatchInsertQuery struct + Columns []string + Table string + Values []interface{} + func (q *BatchInsertQuery) ToSQL() (string, []interface{}) + type BatchUpsertQuery struct + Columns []string + Table string + Values []interface{} + func (q *BatchUpsertQuery) ToSQL() (string, []interface{}) + type Column struct + Descriptor *fields.Descriptor + Index []int + Name string + Order int + Primary bool + type DB struct + Conn *sql.DB + Schema *Schema + func NewDB(conn *sql.DB, schema *Schema) *DB + func (db *DB) BaseQuery(ctx context.Context, query *BaseSelectQuery) ([]interface{}, error) + func (db *DB) Count(ctx context.Context, model interface{}, filter Filter) (int64, error) + func (db *DB) DeleteRow(ctx context.Context, row interface{}) error + func (db *DB) FullScanQuery(ctx context.Context, result interface{}, filter Filter, options *SelectOptions) error + func (db *DB) HasTx(ctx context.Context) bool + func (db *DB) InsertRow(ctx context.Context, row interface{}) (sql.Result, error) + func (db *DB) InsertRows(ctx context.Context, rows interface{}, chunkSize int) error + func (db *DB) Query(ctx context.Context, result interface{}, filter Filter, options *SelectOptions) error + func (db *DB) QueryExecer(ctx context.Context) QueryExecer + func (db *DB) QueryRow(ctx context.Context, result interface{}, filter Filter, options *SelectOptions) error + func (db *DB) UpdateRow(ctx context.Context, row interface{}) error + func (db *DB) UpsertRow(ctx context.Context, row interface{}) (sql.Result, error) + func (db *DB) UpsertRows(ctx context.Context, rows interface{}, chunkSize int) error + func (db *DB) WithDynamicLimit(dynamicLimit DynamicLimit) (*DB, error) + func (db *DB) WithExistingTx(ctx context.Context, tx *sql.Tx) (context.Context, error) + func (db *DB) WithPanicOnNoIndex() (*DB, error) + func (db *DB) WithShardLimit(shardLimit Filter) (*DB, error) + func (db *DB) WithTx(ctx context.Context) (context.Context, *sql.Tx, error) + type DeleteQuery struct + Table string + Where *SimpleWhere + func (q *DeleteQuery) ToSQL() (string, []interface{}) + type DynamicLimit struct + GetLimitFilter DynamicLimitFilterCallback + ShouldContinueOnError DynamicLimitErrorCallback + type DynamicLimitErrorCallback func(err error, table string) bool + type DynamicLimitFilterCallback func(context.Context, string) Filter + type ErrorWithQuery struct + func (e *ErrorWithQuery) Error() string + func (e *ErrorWithQuery) Reason() string + func (e *ErrorWithQuery) Unwrap() error + type ExplainResultRow struct + Extra *string + Id int64 + Key *string + KeyLen *string + PossibleKeys *string + Ref *string + Rows *int64 + SelectType *string + Table *string + TypeColumn *string + type Filter map[string]interface + type InsertQuery struct + Columns []string + Table string + Values []interface{} + func (q *InsertQuery) ToSQL() (string, []interface{}) + type NullBytes struct + Bytes []byte + Valid bool + func (b *NullBytes) Scan(value interface{}) error + func (b *NullBytes) Value() (driver.Value, error) + type PrimaryKeyType int + const AutoIncrement + const UniqueId + type QueryExecer interface + Exec func(query string, args ...interface{}) (sql.Result, error) + ExecContext func(ctx context.Context, query string, args ...interface{}) (sql.Result, error) + Query func(query string, args ...interface{}) (*sql.Rows, error) + QueryContext func(ctx context.Context, query string, args ...interface{}) (*sql.Rows, error) + QueryRow func(query string, args ...interface{}) *sql.Row + QueryRowContext func(ctx context.Context, query string, args ...interface{}) *sql.Row + type SQLQuery interface + ToSQL func() (string, []interface{}) + type Schema struct + ByName map[string]*Table + ByType map[reflect.Type]*Table + func NewSchema() *Schema + func (s *Schema) BuildStruct(tableName string, row []driver.Value) (interface{}, error) + func (s *Schema) MakeBatchInsertRow(rows []interface{}) (*BatchInsertQuery, error) + func (s *Schema) MakeBatchUpsertRow(rows []interface{}) (*BatchUpsertQuery, error) + func (s *Schema) MakeDeleteRow(row interface{}) (*DeleteQuery, error) + func (s *Schema) MakeInsertRow(row interface{}) (*InsertQuery, error) + func (s *Schema) MakeSelect(result interface{}, filter Filter, options *SelectOptions) (*BaseSelectQuery, error) + func (s *Schema) MakeSelectRow(result interface{}, filter Filter, options *SelectOptions) (*BaseSelectQuery, error) + func (s *Schema) MakeTester(table string, filter Filter) (Tester, error) + func (s *Schema) MakeUpdateRow(row interface{}) (*UpdateQuery, error) + func (s *Schema) MakeUpsertRow(row interface{}) (*UpsertQuery, error) + func (s *Schema) MustRegisterType(table string, primaryKeyType PrimaryKeyType, value interface{}) + func (s *Schema) ParseRows(query *SelectQuery, res *sql.Rows) ([]interface{}, error) + func (s *Schema) RegisterType(table string, primaryKeyType PrimaryKeyType, value interface{}) error + func (s *Schema) UnbuildStruct(tableName string, strct interface{}) ([]interface{}, error) + type SelectOptions struct + AllowNoIndex bool + ForUpdate bool + ForceIndex []string + Limit int + OrderBy string + UseIndex []string + Values []interface{} + Where string + func (s *SelectOptions) IncludeFilter(table *Table, filter Filter) error + type SelectQuery struct + Columns []string + Options *SelectOptions + Table string + func (q *SelectQuery) ToSQL() (string, []interface{}) + type SimpleWhere struct + Columns []string + Values []interface{} + func (w *SimpleWhere) ToSQL() (string, []interface{}) + type Table struct + Columns []*Column + ColumnsByName map[string]*Column + Name string + PrimaryKeyType PrimaryKeyType + Scanners *sync.Pool + Type reflect.Type + type Tester interface + Test func(row interface{}) bool + type UpdateQuery struct + Columns []string + Table string + Values []interface{} + Where *SimpleWhere + func (q *UpdateQuery) ToSQL() (string, []interface{}) + type UpsertQuery struct + Columns []string + Table string + Values []interface{} + func (q *UpsertQuery) ToSQL() (string, []interface{})