Documentation
¶
Index ¶
- type Definition
- type Field
- type FieldBool
- type FieldCombo
- type FieldCommon
- type FieldDateTime
- type FieldNumber
- type FieldString
- func (f *FieldString) Generate(sc cql.SearchClause, queryArgumentIndex int) (string, []any, error)
- func (f *FieldString) WithAssumeTsVector() *FieldString
- func (f *FieldString) WithColumn(column string) *FieldString
- func (f *FieldString) WithExact() *FieldString
- func (f *FieldString) WithFullText(language string) *FieldString
- func (f *FieldString) WithILikeOps() *FieldString
- func (f *FieldString) WithLikeOps() *FieldString
- func (f *FieldString) WithLower() *FieldString
- func (f *FieldString) WithPrefixMatchOnly() *FieldString
- func (f *FieldString) WithServerChoiceRel(relation cql.Relation) *FieldString
- func (f *FieldString) WithSplit() *FieldString
- func (f *FieldString) WithoutExact() *FieldString
- type FieldTsVector
- type PgDefinition
- type PgError
- type PgQuery
- type Query
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Definition ¶
type Definition interface {
AddField(name string, field Field) Definition
GetFieldType(name string) Field
Parse(q cql.Query, queryArgumentIndex int) (Query, error)
}
func NewPgDefinition ¶
func NewPgDefinition() Definition
type FieldBool ¶
type FieldBool struct {
FieldCommon
}
func NewFieldBool ¶
func NewFieldBool() *FieldBool
func (*FieldBool) WithColumn ¶
type FieldCombo ¶
type FieldCombo struct {
// contains filtered or unexported fields
}
func NewFieldCombo ¶
func NewFieldCombo(ignoreError bool, fields []Field) *FieldCombo
func (*FieldCombo) Generate ¶
func (f *FieldCombo) Generate(sc cql.SearchClause, queryArgumentIndex int) (string, []any, error)
func (*FieldCombo) GetColumn ¶
func (f *FieldCombo) GetColumn() string
func (*FieldCombo) SetColumn ¶
func (f *FieldCombo) SetColumn(column string)
func (*FieldCombo) Sort ¶
func (f *FieldCombo) Sort() string
type FieldCommon ¶
type FieldCommon struct {
// contains filtered or unexported fields
}
func (*FieldCommon) GetColumn ¶
func (f *FieldCommon) GetColumn() string
func (*FieldCommon) SetColumn ¶
func (f *FieldCommon) SetColumn(column string)
func (*FieldCommon) Sort ¶
func (f *FieldCommon) Sort() string
type FieldDateTime ¶
type FieldDateTime struct {
FieldCommon
// contains filtered or unexported fields
}
func NewFieldDate ¶
func NewFieldDate() *FieldDateTime
func (*FieldDateTime) Generate ¶
func (f *FieldDateTime) Generate(sc cql.SearchClause, queryArgumentIndex int) (string, []any, error)
func (*FieldDateTime) WithColumn ¶
func (f *FieldDateTime) WithColumn(column string) *FieldDateTime
func (*FieldDateTime) WithOnlyDate ¶
func (f *FieldDateTime) WithOnlyDate() *FieldDateTime
type FieldNumber ¶
type FieldNumber struct {
FieldCommon
}
func NewFieldNumber ¶
func NewFieldNumber() *FieldNumber
func (*FieldNumber) Generate ¶
func (f *FieldNumber) Generate(sc cql.SearchClause, queryArgumentIndex int) (string, []any, error)
func (*FieldNumber) WithColumn ¶
func (f *FieldNumber) WithColumn(column string) *FieldNumber
type FieldString ¶
type FieldString struct {
FieldCommon
// contains filtered or unexported fields
}
func NewFieldString ¶
func NewFieldString() *FieldString
func (*FieldString) Generate ¶
func (f *FieldString) Generate(sc cql.SearchClause, queryArgumentIndex int) (string, []any, error)
func (*FieldString) WithAssumeTsVector ¶
func (f *FieldString) WithAssumeTsVector() *FieldString
WithAssumeTsVector assumes underlying column of type tsvector and uses it directly.
func (*FieldString) WithColumn ¶
func (f *FieldString) WithColumn(column string) *FieldString
func (*FieldString) WithExact ¶
func (f *FieldString) WithExact() *FieldString
WithExact enables exact match and using it as a fallback for WithLikeOps when no wildcard operators are used in the term.
func (*FieldString) WithFullText ¶
func (f *FieldString) WithFullText(language string) *FieldString
func (*FieldString) WithILikeOps ¶
func (f *FieldString) WithILikeOps() *FieldString
WithILikeOps enables wildcard-aware case-insensitive matching and disables exact match fallback. This typically requires a pg_trgm (trigram) GIN/GiST index for good performance.
func (*FieldString) WithLikeOps ¶
func (f *FieldString) WithLikeOps() *FieldString
func (*FieldString) WithLower ¶
func (f *FieldString) WithLower() *FieldString
WithLower applies lower() to column and term. Ignored when using WithFullText/WithAssumeTsVector/WithILikeOps.
func (*FieldString) WithPrefixMatchOnly ¶
func (f *FieldString) WithPrefixMatchOnly() *FieldString
WithPrefixMatchOnly allows wildcard operators only at the end of a term. Applies to WithLikeOps/WithILikeOps matching. This is useful when the underlying column is indexed with a regular btree index with text_pattern_ops/varchar_pattern_ops, which does not support leading wildcards.
func (*FieldString) WithServerChoiceRel ¶
func (f *FieldString) WithServerChoiceRel(relation cql.Relation) *FieldString
WithServerChoiceRel configures the server choice relation
func (*FieldString) WithSplit ¶
func (f *FieldString) WithSplit() *FieldString
func (*FieldString) WithoutExact ¶
func (f *FieldString) WithoutExact() *FieldString
WithoutExact disables exact match and using it as fallback for WithLikeOps when no wildcard operators are used in the term.
type FieldTsVector ¶
type FieldTsVector struct {
FieldString
}
func NewFieldTsVector ¶
func NewFieldTsVector() *FieldTsVector
func (*FieldTsVector) WithColumn ¶
func (f *FieldTsVector) WithColumn(column string) *FieldTsVector
func (*FieldTsVector) WithLanguage ¶
func (f *FieldTsVector) WithLanguage(language string) *FieldTsVector
func (*FieldTsVector) WithServerChoiceRel ¶
func (f *FieldTsVector) WithServerChoiceRel(relation cql.Relation) *FieldTsVector
type PgDefinition ¶
type PgDefinition struct {
// contains filtered or unexported fields
}
func (*PgDefinition) AddField ¶
func (pg *PgDefinition) AddField(name string, field Field) Definition
func (*PgDefinition) GetFieldType ¶
func (pg *PgDefinition) GetFieldType(name string) Field
type PgQuery ¶
type PgQuery struct {
// contains filtered or unexported fields
}
func (*PgQuery) GetOrderByClause ¶
func (*PgQuery) GetOrderByFields ¶
func (*PgQuery) GetQueryArguments ¶
func (*PgQuery) GetWhereClause ¶
type Query ¶
type Query interface {
// GetWhereClause returns the SQL WHERE clause generated from the CQL query,
// without the "WHERE" keyword.
// The returned string will contain parameter placeholders (e.g. $1, $2, etc.)
// corresponding to the query arguments returned by GetQueryArguments.
GetWhereClause() string
// GetQueryArguments returns the list of query arguments to be used in the SQL
// query, in the order they should be applied.
GetQueryArguments() []any
// GetOrderByClause returns the SQL ORDER BY clause, or an empty string if no
// sorting is specified.
// If the query includes sorting, the returned string will start with " ORDER BY "
// followed by the sorting fields and directions.
GetOrderByClause() string
// GetOrderByFields returns a list of fields used in the ORDER BY clause, or an
// empty list if no sorting is specified.
GetOrderByFields() []string
}