Documentation
¶
Index ¶
- Variables
- func IsGeoOp(op ExpOp) bool
- type AggregrateOp
- type Arg
- type ArgType
- type Cache
- type ColKey
- type Column
- type Compiler
- func (co *Compiler) AddRole(role, schema, table string, trc TRConfig) error
- func (co *Compiler) Compile(query []byte, vmap map[string]json.RawMessage, role, namespace string) (qc *QCode, err error)
- func (co *Compiler) Find(schema, name string) (sdata.DBTable, error)
- func (co *Compiler) FindPath(from, to, through string) ([]sdata.TPath, error)
- func (co *Compiler) ParseName(name string) string
- type Config
- type Constraint
- type DeleteConfig
- type Exp
- type ExpOp
- type Field
- type FieldType
- type Filter
- type Fragment
- type Function
- type GeoExp
- type GeoUnit
- type InsertConfig
- type Join
- type MColumn
- type MRColumn
- type MTable
- type MType
- type Mutate
- type NewValidFn
- type Order
- type OrderBy
- type Paging
- type PagingType
- type QCode
- type QType
- type QueryConfig
- type Schema
- type Script
- type SelType
- type Select
- type SkipType
- type TConfig
- type TRConfig
- type TableInfo
- type UpdateConfig
- type UpsertConfig
- type ValType
- type ValidErr
- type ValidFn
- type Validation
- type Validator
- type Var
- type Vars
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrUnknownValidator = errors.New("unknown validator")
Functions ¶
Types ¶
type AggregrateOp ¶
type AggregrateOp int8
const ( AgCount AggregrateOp = iota + 1 AgSum AgAvg AgMax AgMin )
func (AggregrateOp) String ¶
func (i AggregrateOp) String() string
type Compiler ¶
type Compiler struct {
// contains filtered or unexported fields
}
type Config ¶
type Config struct {
Vars map[string]string
TConfig map[string]TConfig
DefaultBlock bool
DefaultLimit int
DisableAgg bool
DisableFuncs bool
EnableCamelcase bool
DBSchema string
Validators map[string]Validator
// EnableCacheTracking injects __gj_id fields with primary keys for cache row tracking
EnableCacheTracking bool
// contains filtered or unexported fields
}
type Constraint ¶
type Constraint struct {
VarName string
// contains filtered or unexported fields
}
type DeleteConfig ¶
type Exp ¶
type Exp struct {
Op ExpOp
Joins []Join
Order
OrderBy bool
Left struct {
ID int32
Table string
Col sdata.DBColumn
ColName string
Path []string
}
Right struct {
ValType ValType
Val string
ID int32
Table string
Col sdata.DBColumn
ColName string
ListType ValType
ListVal []string
Path []string
}
Geo *GeoExp // GIS-specific expression data
Children []*Exp
// contains filtered or unexported fields
}
type ExpOp ¶
type ExpOp int8
const ( OpNop ExpOp = iota OpAnd OpOr OpNot OpEquals OpNotEquals OpGreaterOrEquals OpLesserOrEquals OpGreaterThan OpLesserThan OpIn OpNotIn OpLike OpNotLike OpILike OpNotILike OpSimilar OpNotSimilar OpRegex OpNotRegex OpIRegex OpNotIRegex OpContains OpContainedIn OpHasInCommon OpHasKey OpHasKeyAny OpHasKeyAll OpIsNull OpIsNotNull OpTsQuery OpFalse OpNotDistinct OpDistinct OpEqualsTrue OpNotEqualsTrue OpSelectExists OpJSONPath // JSON path operator (->) OpJSONPathText // JSON path text operator (->>) // GIS/Spatial operators OpGeoDistance // ST_DWithin - distance-based filtering OpGeoWithin // ST_Within - geometry A within B OpGeoContains // ST_Contains - geometry A contains B OpGeoIntersects // ST_Intersects - geometries intersect OpGeoCoveredBy // ST_CoveredBy - geometry A covered by B OpGeoCovers // ST_Covers - geometry A covers B OpGeoTouches // ST_Touches - geometries touch at boundary OpGeoOverlaps // ST_Overlaps - geometries overlap OpGeoNear // MongoDB $near / $nearSphere )
type Function ¶
type Function struct {
Name string
// Col sdata.DBColumn
Func sdata.DBFunction
Args []Arg
Agg bool
}
type GeoExp ¶ added in v3.2.0
type GeoExp struct {
// Geometry specification (one of these will be set)
Point []float64 // [longitude, latitude] for point
Polygon [][]float64 // Array of [lon, lat] pairs for polygon ring
GeoJSON []byte // Full GeoJSON geometry object
// Operation parameters
Distance float64 // Distance value for st_dwithin
DistanceVar string // Variable name for distance if parameterized
Unit GeoUnit // Distance unit (meters, km, miles, feet)
SRID int // Spatial Reference ID (default 4326 = WGS84)
// For MongoDB
MinDistance float64 // $minDistance for $near
Spherical bool // Use spherical calculations
}
GeoExp holds GIS-specific expression data
type GeoUnit ¶ added in v3.2.0
type GeoUnit int8
GeoUnit represents distance units for GIS operations
type InsertConfig ¶
type NewValidFn ¶
type PagingType ¶
type PagingType int8
const ( PTOffset PagingType = iota PTForward PTBackward )
func (PagingType) String ¶
func (i PagingType) String() string
type QCode ¶
type QCode struct {
Type QType
SType QType
Name string
ActionVar string
ActionVal json.RawMessage
Vars []Var
Selects []Select
Consts []Constraint
Roots []int32
Mutates []Mutate
MUnions map[string][]int32
Schema *sdata.DBSchema
Remotes int32
Cache Cache
Typename bool
Query []byte
Fragments []Fragment
// contains filtered or unexported fields
}
func (*QCode) ProcessConstraints ¶
func (qc *QCode) ProcessConstraints(vmap map[string]json.RawMessage) (errs []ValidErr)
type QType ¶
type QType int8
func GetQType ¶
func GetQType(t graph.ParserType) QType
func GetQTypeByName ¶
type QueryConfig ¶
type Schema ¶
type Schema struct {
Type string
Version int
Schema string
Columns []sdata.DBColumn
Functions []sdata.DBFunction
}
func ParseSchema ¶
type Select ¶
type Select struct {
Field
Type SelType
Singular bool
Typename bool
Table string
Schema string
// Database is the target database for this select (multi-database support).
// Empty string means the default database.
Database string
Fields []Field
BCols []Column
IArgs []Arg
Where Filter
OrderBy []OrderBy
DistinctOn []sdata.DBColumn
GroupCols bool
Paging Paging
Children []int32
Ti sdata.DBTable
Rel sdata.DBRel
Joins []Join
// contains filtered or unexported fields
}
type SkipType ¶
type SkipType int8
const ( SkipTypeNone SkipType = iota SkipTypeDrop SkipTypeNulled SkipTypeUserNeeded SkipTypeBlocked SkipTypeRemote // SkipTypeDatabaseJoin indicates this select targets a different database // and needs to be handled via cross-database join (similar to remote join // but for in-process database calls rather than HTTP) SkipTypeDatabaseJoin )
type TRConfig ¶
type TRConfig struct {
Query QueryConfig
Insert InsertConfig
Update UpdateConfig
Upsert UpsertConfig
Delete DeleteConfig
}
type UpdateConfig ¶
type UpsertConfig ¶
type ValidFn ¶
type ValidFn func(Vars, Constraint) bool
type Validation ¶
type Validator ¶
type Validator struct {
Description string
Type string
List bool
Types []graph.ParserType
NewFn NewValidFn
}
type Var ¶
type Var struct {
Name string
Val json.RawMessage
}
type Vars ¶
type Vars map[string]json.RawMessage
Click to show internal directories.
Click to hide internal directories.