Documentation ¶
Index ¶
- func BeginTransaction(db DBContext) (*sql.Tx, error)
- type Column
- type ColumnKind
- type DBContext
- type DBTransaction
- type Fields
- type Filters
- type FindOptions
- type Order
- type Pagination
- type PgSQLRepo
- func (r PgSQLRepo[T]) Columns() []Column
- func (r PgSQLRepo[T]) Create(ctx context.Context, db DBContext, item *T) error
- func (r PgSQLRepo[T]) DeleteMany(ctx context.Context, db DBContext, filters Filters) error
- func (r PgSQLRepo[T]) DeleteOne(ctx context.Context, db DBContext, item T) error
- func (r PgSQLRepo[T]) FindMany(ctx context.Context, db DBContext, opts FindOptions) ([]T, error)
- func (r PgSQLRepo[T]) FindOne(ctx context.Context, db DBContext, filters Filters) (*T, error)
- func (r PgSQLRepo[T]) TableName() string
- func (r PgSQLRepo[T]) UpdateMany(ctx context.Context, db DBContext, fields Fields, filters Filters) error
- func (r PgSQLRepo[T]) UpdateOne(ctx context.Context, db DBContext, item T) error
- type Repo
- type SQLRepoConfig
- type UpdateOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Column ¶
type Column struct { Name string Kind ColumnKind }
type ColumnKind ¶
type ColumnKind int
const ( ValueColumn ColumnKind = iota KeyColumn GeneratedKeyColumn CreatedAtColumn UpdatedAtColumn )
type DBTransaction ¶
type FindOptions ¶
type FindOptions struct { Filters Filters Pagination *Pagination Order *Order }
type Pagination ¶
type PgSQLRepo ¶
type PgSQLRepo[T any] struct { // contains filtered or unexported fields }
func NewPgSQLRepo ¶
func NewPgSQLRepo[T any](cfg SQLRepoConfig[T]) (*PgSQLRepo[T], error)
func (PgSQLRepo[T]) DeleteMany ¶
func (PgSQLRepo[T]) UpdateMany ¶
type Repo ¶
type Repo[T any] interface { Create(ctx context.Context, db DBContext, item *T) error UpdateOne(ctx context.Context, db DBContext, item T) error UpdateMany(ctx context.Context, db DBContext, fields Fields, filters Filters) error DeleteOne(ctx context.Context, db DBContext, item T) error DeleteMany(ctx context.Context, db DBContext, filters Filters) error FindOne(ctx context.Context, db DBContext, filters Filters) (*T, error) FindMany(ctx context.Context, db DBContext, opts FindOptions) ([]T, error) }
type SQLRepoConfig ¶
type UpdateOptions ¶
type UpdateOptions struct {
Filters Filters
}
Click to show internal directories.
Click to hide internal directories.