Documentation
¶
Index ¶
- Variables
- func Prepare(statement string, parameters map[string]any) (string, []any, error)
- type DBAL
- type Driver
- type Entity
- type EntityInformation
- type MySQL
- func (q MySQL) DSN() string
- func (g MySQL) Driver() string
- func (g MySQL) GenerateDelete(entity Entity) (string, map[string]any, error)
- func (g MySQL) GenerateInsert(entity Entity) (string, map[string]any, error)
- func (g MySQL) GenerateSave(entity Entity) (string, map[string]any, error)
- func (g MySQL) GenerateSelect(entity Entity) (Query, error)
- func (g MySQL) GenerateUpdate(entity Entity) (string, map[string]any, error)
- 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 Driver ¶ added in v0.0.5
type Driver interface {
DSN() string
Driver() string
GenerateInsert(entity Entity) (string, map[string]any, error)
GenerateDelete(entity Entity) (string, map[string]any, error)
GenerateSave(entity Entity) (string, map[string]any, error)
GenerateSelect(entity Entity) (Query, error)
GenerateUpdate(entity Entity) (string, map[string]any, error)
}
type Entity ¶
type Entity interface {
EntityInformation() EntityInformation
}
type EntityInformation ¶
type EntityInformation struct {
TableName string
}
type MySQL ¶ added in v0.0.5
func (MySQL) GenerateDelete ¶ added in v0.0.5
func (MySQL) GenerateInsert ¶ added in v0.0.5
func (MySQL) GenerateSave ¶ added in v0.0.5
func (MySQL) GenerateSelect ¶ added in v0.0.5
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 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.