Documentation ¶
Index ¶
- type Option
- type Table
- func (t *Table[T]) Delete(ctx context.Context, db *sqlx.DB, query string, args ...any) (int64, error)
- func (t *Table[T]) Fetch(ctx context.Context, db *sqlx.DB, col string, val any) (*T, error)
- func (t *Table[T]) Find(ctx context.Context, db *sqlx.DB, id any) (*T, error)
- func (t *Table[T]) Insert(ctx context.Context, db *sqlx.DB, obj *T) error
- func (t *Table[T]) Replace(ctx context.Context, db *sqlx.DB, obj *T) error
- func (t *Table[T]) Select(ctx context.Context, db *sqlx.DB, query string, args ...any) ([]*T, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Table ¶
type Table[T any] struct { // contains filtered or unexported fields }
Table provides boilerplate ops for some table with sqlx.
func (*Table[T]) Delete ¶
func (t *Table[T]) Delete(ctx context.Context, db *sqlx.DB, query string, args ...any) (int64, error)
Delete deletes records matching the query.
func (*Table[T]) Fetch ¶
Fetch returns a single record with a value matching a given field. Mostly useful for fetching by unique values.
Click to show internal directories.
Click to hide internal directories.