Documentation ¶
Index ¶
- func New(driverName string, conStr string) (*sql.DB, error)
- type Completer
- type Query
- func (q Query) Create(name string, definition ...string) error
- func (q Query) CreateCtx(ctx context.Context, name string, definition ...string) error
- func (q Query) Delete(i interface{}) Completer
- func (q Query) Find(i interface{}) Completer
- func (q Query) FindAll(i interface{}) ([]map[string]interface{}, error)
- func (q Query) FindAllCtx(ctx context.Context, i interface{}) ([]map[string]interface{}, error)
- func (q Query) Insert(i interface{}) (int64, error)
- func (q Query) InsertCtx(ctx context.Context, i interface{}) (int64, error)
- func (q Query) TxCreateCtx(ctx context.Context, tx *sql.Tx, name string, definition ...string) error
- func (q Query) TxFindAllCtx(ctx context.Context, tx *sql.Tx, i interface{}) ([]map[string]interface{}, error)
- func (q Query) TxInsertCtx(ctx context.Context, tx *sql.Tx, i interface{}) (int64, error)
- func (q Query) Update(i interface{}) Completer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Completer ¶ added in v0.1.3
type Completer interface { /* * set update data * m equals struct matching db relation */ Set(m map[string]interface{}) Completer /* * execute non returning query like update and delete */ Apply() error /* * execute non returning query like update and delete with context */ ApplyCtx(ctx context.Context) error /* * execute non returning query like update and delete with context in a transaction */ TxApplyCtx(ctx context.Context, tx *sql.Tx) error /* * execute select or queries returning many rows */ Many(i interface{}) error /* * execute select or queries returning many rows with context */ ManyCtx(ctx context.Context, i interface{}) error /* * execute select or queries returning many rows with context in a transaction */ TxManyCtx(ctx context.Context, tx *sql.Tx, i interface{}) error /* * execute select scan into provided interface */ One(i interface{}) error /* * execute select scan into provided interface with context */ OneCtx(ctx context.Context, i interface{}) error /* * execute select scan into provided interface with context in a transaction */ TxOneCtx(ctx context.Context, tx *sql.Tx, i interface{}) error /* * where condition * could be map[string]interface{} or []map[string]interface{} * e.g. map[string]interface{ "id": 1 } */ Where(any) Completer /* * perform query for values in list */ In(field string, values []interface{}) Completer }
type Query ¶ added in v0.1.3
func (Query) FindAllCtx ¶ added in v0.1.5
find all with context from relation
func (Query) TxCreateCtx ¶ added in v0.1.9
func (q Query) TxCreateCtx(ctx context.Context, tx *sql.Tx, name string, definition ...string) error
tx create table with context
func (Query) TxFindAllCtx ¶ added in v0.1.9
func (q Query) TxFindAllCtx(ctx context.Context, tx *sql.Tx, i interface{}) ([]map[string]interface{}, error)
TX find all with context from relation
func (Query) TxInsertCtx ¶ added in v0.1.9
TX insert into table with context
Click to show internal directories.
Click to hide internal directories.