Documentation
¶
Index ¶
- Variables
- func GenerateDelete(entity Entity) (string, map[string]any, error)
- func GenerateInsert(entity Entity) (string, map[string]any, error)
- func GenerateSave(entity Entity) (string, map[string]any, error)
- func GenerateUpdate(entity Entity) (string, map[string]any, error)
- func Prepare(statement string, parameters map[string]any) (string, []any, error)
- type Config
- type DBAL
- type Entity
- type EntityInformation
- type Query
- type QueryModifier
- type Repository
- type Selector
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrNoRows = errors.New("no rows")
Functions ¶
Types ¶
type DBAL ¶
type DBAL struct {
// contains filtered or unexported fields
}
func (*DBAL) RawExecute ¶
type Entity ¶
type Entity interface {
EntityInformation() EntityInformation
}
type EntityInformation ¶
type EntityInformation struct {
TableName string
}
type Query ¶
type Query struct {
Select []string
From string
Joins []string
Where string
GroupBy string
OrderBy string
Limit struct {
Count int
Offset int
}
Parameters map[string]any
}
func GenerateSelect ¶
func ParseQuery ¶
type QueryModifier ¶
func WithAdditionalWhere ¶ added in v0.0.2
func WithAdditionalWhere(where string, parameters map[string]any) QueryModifier
func WithLimitOverride ¶
func WithLimitOverride(size int, offset int) QueryModifier
type Repository ¶
type Repository[ID ~uint64, T Entity] struct { Selector[T] // contains filtered or unexported fields }
func NewRepository ¶
func NewRepository[ID ~uint64, T Entity](dbal *DBAL) Repository[ID, T]
func (*Repository[ID, T]) Insert ¶
func (q *Repository[ID, T]) Insert(ctx context.Context, entity T) (ID, error)
type Selector ¶
type Selector[T any] struct { // contains filtered or unexported fields }
func (*Selector[T]) SelectMultiple ¶
func (q *Selector[T]) SelectMultiple(ctx context.Context, mods ...QueryModifier) ([]T, error)
func (*Selector[T]) SelectSingle ¶
func (q *Selector[T]) SelectSingle(ctx context.Context, mods ...QueryModifier) (T, error)
Click to show internal directories.
Click to hide internal directories.