Documentation
¶
Overview ¶
Package database provides the database interface.
Index ¶
Constants ¶
View Source
const ( FieldID = "id" FieldCreatedAt = "created_at" FieldUpdatedAt = "updated_at" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ColumnM ¶
type ColumnM map[string]ColumnType
type ColumnType ¶
type ColumnType string
type Database ¶
type Database[T any] interface { Executor[T] Insert(ctx context.Context, builder query.Query) (string, error) Select(ctx context.Context, builder query.Query, scan ScanOneFn[T]) (*T, error) Delete(ctx context.Context, id string) error Total(ctx context.Context) (int64, error) Table() string }
nolint:lll
type ExecResult ¶
type ExecResult interface {
RowsAffected() int64
}
type Executor ¶
type Executor[T any] interface { Exec(ctx context.Context, builder query.Query) (ExecResult, error) Query(ctx context.Context, builder query.Query, dest ...any) error CollectRows(ctx context.Context, builder query.Query, scan ScanFn[T]) ([]*T, error) CollectOneRow(ctx context.Context, builder query.Query, scan ScanOneFn[T]) (*T, error) }
nolint:lll
Click to show internal directories.
Click to hide internal directories.