Documentation ¶
Index ¶
- Constants
- Variables
- func CreateFieldsTsVector(values Map, fields ...Field) string
- func Entity[E entity](override ...Override) *E
- func TsVector(values ...any) string
- type BuildResult
- type DuplicatesBuilder
- type EntityBuilder
- type EntityMigrator
- type Field
- type FilterBuilder
- type FindRepository
- type Map
- type Modifier
- type Override
- type QueryBuilder
- type RelationshipBuilder
- type RemoveRepository
- type RepositoryManager
- type Runner
- type Safe
- type SaveRepository
- type SelectorBuilder
- type ShapeBuilder
- type SortBuilder
- type Sorter
- type TemporaryBuilder
- type Value
Constants ¶
View Source
const ( Insert = "INSERT" Update = "UPDATE" )
View Source
const ( SortUp = "ASC" SortDown = "DESC" )
View Source
const (
Id = "id"
)
View Source
const (
TsVectorDataType = "TSVECTOR"
)
Variables ¶
View Source
var ( ErrorMissingPrimaryKey = errors.New("missing primary key") ErrorMissingDatabase = errors.New("missing database connection") ErrorMismatchQueryTarget = errors.New("mismatch query target len with builders") ErrorTargetNoPtr = errors.New("query target is not a pointer") ErrorInvalidMap = errors.New("invalid map type, needs to be map[string]any") )
Functions ¶
func CreateFieldsTsVector ¶
Types ¶
type BuildResult ¶
type DuplicatesBuilder ¶
type DuplicatesBuilder interface { QueryBuilder Prevent(fields ...QueryBuilder) ShapeBuilder Remove(remove ...bool) ShapeBuilder }
type EntityBuilder ¶
type EntityBuilder struct {
// contains filtered or unexported fields
}
func (EntityBuilder) Field ¶
func (b EntityBuilder) Field(name string) Field
type EntityMigrator ¶
type EntityMigrator interface { Cascade(cascade ...bool) EntityMigrator GetUpSql() string GetDownSql() string Up() error Down() error MustUp() MustDown() }
func Migrate ¶
func Migrate[E entity](db *esquel.DB) EntityMigrator
type Field ¶
type Field interface { QueryBuilder Default(value any) Field NotNull(notNull ...bool) Field Prefix(prefix string) Field PrimaryKey(primaryKey ...bool) Field Type(dataType string) Field Unique(unique ...bool) Field Relationship(relationship Field) Field CreateValue(fn func(operation string, values Map) Value) Field Name() string TsVector() Field Serial() Field Bool() Field Char(n int) Field Varchar(n int) Field Jsonb() Field Int() Field Float() Field Timestamp() Field Timestampz() Field }
type FilterBuilder ¶
type FilterBuilder interface { QueryBuilder Group(builders ...FilterBuilder) FilterBuilder Field(field QueryBuilder) FilterBuilder Equal(equal ...bool) FilterBuilder Is() FilterBuilder In(in ...bool) FilterBuilder Value(value any, name ...string) FilterBuilder Gt() FilterBuilder Gte() FilterBuilder Lt() FilterBuilder Lte() FilterBuilder Match() FilterBuilder Not(not ...bool) FilterBuilder TsQuery(values ...any) FilterBuilder Null() FilterBuilder }
func Filter ¶
func Filter(modifiers ...Modifier) FilterBuilder
type FindRepository ¶
type QueryBuilder ¶
type QueryBuilder interface {
Build() BuildResult
}
func Fragment ¶
func Fragment(builders ...QueryBuilder) QueryBuilder
func If ¶
func If(condition bool, qb QueryBuilder) QueryBuilder
func Use ¶
func Use(values any) QueryBuilder
type RelationshipBuilder ¶
type RelationshipBuilder interface { QueryBuilder Keep() RelationshipBuilder Prefer() RelationshipBuilder Intersect() RelationshipBuilder Unify() RelationshipBuilder Combine() RelationshipBuilder }
func Relationship ¶
func Relationship(relationshipField Field) RelationshipBuilder
type RemoveRepository ¶
type RepositoryManager ¶
type RepositoryManager[E entity] interface { Find(builders ...QueryBuilder) FindRepository Save(builders ...QueryBuilder) SaveRepository Remove(builders ...QueryBuilder) RemoveRepository }
func Repository ¶
func Repository[E entity](db *esquel.DB) RepositoryManager[E]
type Runner ¶
type SaveRepository ¶
type SaveRepository interface { QueryBuilder Run(result any, runner ...Runner) error MustRun(result any, runner ...Runner) ForceInsert() SaveRepository }
type SelectorBuilder ¶
type SelectorBuilder interface { QueryBuilder Group(qb QueryBuilder) SelectorBuilder Field(field QueryBuilder) SelectorBuilder As(value string) SelectorBuilder Count(f QueryBuilder) SelectorBuilder Sum(f QueryBuilder) SelectorBuilder Min(qb QueryBuilder) SelectorBuilder Max(qb QueryBuilder) SelectorBuilder Avg(qb QueryBuilder) SelectorBuilder }
func Selector ¶
func Selector(fields ...QueryBuilder) SelectorBuilder
type ShapeBuilder ¶
type ShapeBuilder interface { QueryBuilder Start(start int) ShapeBuilder Max(max int) ShapeBuilder Duplicates() DuplicatesBuilder Sort(aliases ...map[string]Field) SortBuilder }
func Shape ¶
func Shape() ShapeBuilder
type SortBuilder ¶
type SortBuilder interface { QueryBuilder Use(sorters ...Sorter) SortBuilder Up(field QueryBuilder) SortBuilder Down(field QueryBuilder) SortBuilder }
type TemporaryBuilder ¶
type TemporaryBuilder interface { QueryBuilder }
func Temporary ¶
func Temporary(name string, qb QueryBuilder) TemporaryBuilder
Source Files ¶
- data-types.go
- entity-builder.go
- entity-migrator.go
- entity.go
- error.go
- field.go
- filter-builder.go
- fragment.go
- if.go
- modifier.go
- query.go
- relationship-builder.go
- repository-find.go
- repository-remove.go
- repository-save.go
- repository.go
- runner.go
- safe.go
- selector-builder.go
- shape-builder.go
- sql-builder.go
- temporary-builder.go
- tests.go
- tree.go
- util.go
- values-builder.go
Click to show internal directories.
Click to hide internal directories.