Documentation
ΒΆ
Index ΒΆ
- Constants
- type ComparisonOperator
- type CompositeCondition
- type CompositeJoinCondition
- type Condition
- type CustomCondition
- type CustomJoinCondition
- type CustomSelectField
- type Engine
- type ErrInvalidQuery
- type FromComponent
- type JoinComponent
- type JoinCondition
- type JoinConditionEvaluator
- type JoinType
- type JoinedRow
- type LikeOperator
- type LogicalOperator
- type Operator
- type Query
- type QueryBuilder
- func (qb *QueryBuilder) And(other *QueryBuilder) *QueryBuilder
- func (qb *QueryBuilder) Build() (*Query, error)
- func (qb *QueryBuilder) From(table string) *QueryBuilder
- func (qb *QueryBuilder) InnerJoin(table string) *QueryBuilder
- func (qb *QueryBuilder) LeftJoin(table string) *QueryBuilder
- func (qb *QueryBuilder) On(leftTable, leftCol, operator, rightTable, rightCol string) *QueryBuilder
- func (qb *QueryBuilder) OnFunc(fn func(row map[string][]string, tables map[string]*Table) (bool, error)) *QueryBuilder
- func (qb *QueryBuilder) Or(other *QueryBuilder) *QueryBuilder
- func (qb *QueryBuilder) RightJoin(table string) *QueryBuilder
- func (qb *QueryBuilder) Select(columns ...string) *QueryBuilder
- func (qb *QueryBuilder) SelectCustom(name string, ...) *QueryBuilder
- func (qb *QueryBuilder) Union(other *QueryBuilder) *QueryBuilder
- func (qb *QueryBuilder) UnionAll(other *QueryBuilder) *QueryBuilder
- func (qb *QueryBuilder) Where(column, operator, value string) *QueryBuilder
- func (qb *QueryBuilder) WhereFunc(fn func(row map[string][]string, tables map[string]*Table) (bool, error)) *QueryBuilder
- type QueryComponent
- type Result
- func (r Result) Bool() (bool, error)
- func (r Result) Date() (time.Time, error)
- func (r Result) DateTime() (time.Time, error)
- func (r Result) Float() (float64, error)
- func (r Result) Int() (int, error)
- func (r Result) Must() string
- func (r Result) MustBool() bool
- func (r Result) MustDate() time.Time
- func (r Result) MustDateTime() time.Time
- func (r Result) MustFloat() float64
- func (r Result) MustInt() int
- func (r Result) MustTime(layout string) time.Time
- func (r Result) String() (string, error)
- func (r Result) Time(layout string) (time.Time, error)
- type SelectComponent
- type SimpleCondition
- type Table
- type TableRow
- type UnionComponent
- type UnionType
- type WhereComponent
Constants ΒΆ
View Source
const ( DateFormat = "2006-01-02" DateTimeFormat = "2006-01-02 15:04:05" )
Common date formats
Variables ΒΆ
This section is empty.
Functions ΒΆ
This section is empty.
Types ΒΆ
type ComparisonOperator ΒΆ
type ComparisonOperator string
const ( Equal ComparisonOperator = "=" NotEqual ComparisonOperator = "!=" GreaterThan ComparisonOperator = ">" GreaterThanEqual ComparisonOperator = ">=" LessThan ComparisonOperator = "<" LessThanEqual ComparisonOperator = "<=" )
func (ComparisonOperator) Evaluate ΒΆ
func (op ComparisonOperator) Evaluate(left, right string) (bool, error)
func (ComparisonOperator) String ΒΆ
func (op ComparisonOperator) String() string
type CompositeCondition ΒΆ
type CompositeCondition struct { Left Condition Right Condition Operator LogicalOperator }
func NewCompositeCondition ΒΆ
func NewCompositeCondition(left, right Condition, operator string) (*CompositeCondition, error)
func (*CompositeCondition) Type ΒΆ
func (c *CompositeCondition) Type() string
type CompositeJoinCondition ΒΆ
type CompositeJoinCondition struct { Left JoinConditionEvaluator Right JoinConditionEvaluator Operator LogicalOperator }
func (*CompositeJoinCondition) EvaluateJoin ΒΆ
type CustomCondition ΒΆ
func (*CustomCondition) Type ΒΆ
func (fn *CustomCondition) Type() string
type CustomJoinCondition ΒΆ
func (CustomJoinCondition) EvaluateJoin ΒΆ
type CustomSelectField ΒΆ
type Engine ΒΆ
type Engine struct {
// contains filtered or unexported fields
}
func (*Engine) CreateTable ΒΆ
type ErrInvalidQuery ΒΆ
type ErrInvalidQuery struct {
Message string
}
func (*ErrInvalidQuery) Error ΒΆ
func (e *ErrInvalidQuery) Error() string
type FromComponent ΒΆ
type FromComponent struct {
Table string
}
func (*FromComponent) Type ΒΆ
func (f *FromComponent) Type() string
func (*FromComponent) Validate ΒΆ
func (f *FromComponent) Validate() error
type JoinComponent ΒΆ
type JoinComponent struct { Table string Condition JoinConditionEvaluator JoinType JoinType }
func (*JoinComponent) Type ΒΆ
func (j *JoinComponent) Type() string
func (*JoinComponent) Validate ΒΆ
func (j *JoinComponent) Validate() error
type JoinCondition ΒΆ
type JoinCondition struct { LeftTable string LeftCol string Op Operator RightTable string RightCol string }
func (*JoinCondition) EvaluateJoin ΒΆ
type JoinConditionEvaluator ΒΆ
type LikeOperator ΒΆ
type LikeOperator struct{}
func (LikeOperator) Evaluate ΒΆ
func (op LikeOperator) Evaluate(value, pattern string) (bool, error)
func (LikeOperator) String ΒΆ
func (op LikeOperator) String() string
type LogicalOperator ΒΆ
type LogicalOperator string
LogicalOperator represents logical operators (AND, OR)
const ( And LogicalOperator = "AND" Or LogicalOperator = "OR" )
func (LogicalOperator) Evaluate ΒΆ
func (op LogicalOperator) Evaluate(left, right string) (bool, error)
func (LogicalOperator) String ΒΆ
func (op LogicalOperator) String() string
type Operator ΒΆ
func GetOperator ΒΆ
type Query ΒΆ
type Query struct { Select *SelectComponent From *FromComponent Joins []*JoinComponent Where *WhereComponent Union *UnionComponent }
type QueryBuilder ΒΆ
type QueryBuilder struct {
// contains filtered or unexported fields
}
func NewQuery ΒΆ
func NewQuery() *QueryBuilder
func Where ΒΆ
func Where(column, operator, value string) *QueryBuilder
func (*QueryBuilder) And ΒΆ
func (qb *QueryBuilder) And(other *QueryBuilder) *QueryBuilder
func (*QueryBuilder) Build ΒΆ
func (qb *QueryBuilder) Build() (*Query, error)
func (*QueryBuilder) From ΒΆ
func (qb *QueryBuilder) From(table string) *QueryBuilder
func (*QueryBuilder) InnerJoin ΒΆ
func (qb *QueryBuilder) InnerJoin(table string) *QueryBuilder
func (*QueryBuilder) LeftJoin ΒΆ
func (qb *QueryBuilder) LeftJoin(table string) *QueryBuilder
func (*QueryBuilder) On ΒΆ
func (qb *QueryBuilder) On(leftTable, leftCol, operator, rightTable, rightCol string) *QueryBuilder
func (*QueryBuilder) OnFunc ΒΆ
func (qb *QueryBuilder) OnFunc(fn func(row map[string][]string, tables map[string]*Table) (bool, error)) *QueryBuilder
func (*QueryBuilder) Or ΒΆ
func (qb *QueryBuilder) Or(other *QueryBuilder) *QueryBuilder
func (*QueryBuilder) RightJoin ΒΆ
func (qb *QueryBuilder) RightJoin(table string) *QueryBuilder
func (*QueryBuilder) Select ΒΆ
func (qb *QueryBuilder) Select(columns ...string) *QueryBuilder
func (*QueryBuilder) SelectCustom ΒΆ
func (qb *QueryBuilder) SelectCustom(name string, fn func(row map[string][]string, tables map[string]*Table) (string, error)) *QueryBuilder
func (*QueryBuilder) Union ΒΆ
func (qb *QueryBuilder) Union(other *QueryBuilder) *QueryBuilder
func (*QueryBuilder) UnionAll ΒΆ
func (qb *QueryBuilder) UnionAll(other *QueryBuilder) *QueryBuilder
func (*QueryBuilder) Where ΒΆ
func (qb *QueryBuilder) Where(column, operator, value string) *QueryBuilder
func (*QueryBuilder) WhereFunc ΒΆ
func (qb *QueryBuilder) WhereFunc(fn func(row map[string][]string, tables map[string]*Table) (bool, error)) *QueryBuilder
type QueryComponent ΒΆ
type Result ΒΆ
type Result struct {
// contains filtered or unexported fields
}
func (Result) MustDateTime ΒΆ
type SelectComponent ΒΆ
type SelectComponent struct { Columns []string CustomColumns []CustomSelectField }
func (*SelectComponent) Type ΒΆ
func (s *SelectComponent) Type() string
func (*SelectComponent) Validate ΒΆ
func (s *SelectComponent) Validate() error
type SimpleCondition ΒΆ
func NewSimpleCondition ΒΆ
func NewSimpleCondition(column, operator, value string) (*SimpleCondition, error)
func (*SimpleCondition) Type ΒΆ
func (c *SimpleCondition) Type() string
type UnionComponent ΒΆ
func (*UnionComponent) Type ΒΆ
func (u *UnionComponent) Type() string
func (*UnionComponent) Validate ΒΆ
func (u *UnionComponent) Validate() error
type WhereComponent ΒΆ
type WhereComponent struct {
Condition Condition
}
func (*WhereComponent) Type ΒΆ
func (w *WhereComponent) Type() string
func (*WhereComponent) Validate ΒΆ
func (w *WhereComponent) Validate() error
Source Files
ΒΆ
Click to show internal directories.
Click to hide internal directories.