Documentation ¶
Index ¶
- Constants
- func ColumnMapper(column *rel.Column) (string, int, int)
- func ColumnOptionsMapper(column *rel.Column) string
- func DropKeyMapper(keyType rel.KeyType) string
- func ExtractString(s, left, right string) string
- type Cursor
- type DeleteBuilder
- type ErrorMapper
- type IncrementFunc
- type IndexBuilder
- type InsertAllBuilder
- type InsertBuilder
- type QueryBuilder
- type SQL
- func (s SQL) Aggregate(ctx context.Context, query rel.Query, mode string, field string) (int, error)
- func (s SQL) Apply(ctx context.Context, migration rel.Migration) errordeprecated
- func (s SQL) Begin(ctx context.Context) (rel.Adapter, error)
- func (s SQL) Close() error
- func (s SQL) Commit(ctx context.Context) error
- func (s SQL) Delete(ctx context.Context, query rel.Query) (int, error)
- func (s SQL) DoExec(ctx context.Context, statement string, args []any) (sql.Result, error)
- func (s SQL) DoQuery(ctx context.Context, statement string, args []any) (*sql.Rows, error)
- func (s SQL) Exec(ctx context.Context, statement string, args []any) (int64, int64, error)
- func (s SQL) Insert(ctx context.Context, query rel.Query, primaryField string, ...) (any, error)
- func (s SQL) InsertAll(ctx context.Context, query rel.Query, primaryField string, fields []string, ...) ([]any, error)
- func (s *SQL) Instrumentation(instrumenter rel.Instrumenter)
- func (s SQL) Name() string
- func (s SQL) Ping(ctx context.Context) error
- func (s SQL) Query(ctx context.Context, query rel.Query) (rel.Cursor, error)
- func (s SQL) Rollback(ctx context.Context) error
- func (s SQL) SchemaApply(ctx context.Context, migration rel.Migration) error
- func (s SQL) Update(ctx context.Context, query rel.Query, primaryField string, ...) (int, error)
- type TableBuilder
- type UpdateBuilder
Constants ¶
View Source
const DefaultTimeLayout = "2006-01-02 15:04:05"
DefaultTimeLayout default time layout.
Variables ¶
This section is empty.
Functions ¶
func ColumnOptionsMapper ¶ added in v0.16.0
ColumnOptionsMapper function.
func DropKeyMapper ¶ added in v0.14.0
func ExtractString ¶
ExtractString between two string.
Types ¶
type DeleteBuilder ¶
type DeleteBuilder interface {
Build(table string, filter rel.FilterQuery) (string, []any)
}
type IndexBuilder ¶
type InsertAllBuilder ¶
type InsertBuilder ¶
type QueryBuilder ¶
type SQL ¶
type SQL struct { QueryBuilder QueryBuilder InsertBuilder InsertBuilder InsertAllBuilder InsertAllBuilder UpdateBuilder UpdateBuilder DeleteBuilder DeleteBuilder TableBuilder TableBuilder IndexBuilder IndexBuilder Increment int IncrementFunc IncrementFunc ErrorMapper ErrorMapper DB *sql.DB Tx *sql.Tx Savepoint int Instrumenter rel.Instrumenter }
SQL base adapter.
func (SQL) Aggregate ¶
func (s SQL) Aggregate(ctx context.Context, query rel.Query, mode string, field string) (int, error)
Aggregate record using given query.
func (SQL) Insert ¶
func (s SQL) Insert(ctx context.Context, query rel.Query, primaryField string, mutates map[string]rel.Mutate, onConflict rel.OnConflict) (any, error)
Insert inserts a record to database and returns its id.
func (SQL) InsertAll ¶
func (s SQL) InsertAll(ctx context.Context, query rel.Query, primaryField string, fields []string, bulkMutates []map[string]rel.Mutate, onConflict rel.OnConflict) ([]any, error)
InsertAll inserts multiple records to database and returns its ids.
func (*SQL) Instrumentation ¶
func (s *SQL) Instrumentation(instrumenter rel.Instrumenter)
Instrumentation set instrumenter for this adapter.
func (SQL) SchemaApply ¶
SchemaApply performs migration to database.
type TableBuilder ¶
type UpdateBuilder ¶
Click to show internal directories.
Click to hide internal directories.