Documentation
¶
Index ¶
- Constants
- Variables
- func AddExtensions(origin *ast.SchemaDocument, extension *ast.SchemaDocument) (*ast.Schema, error)
- func AggregatedObjectDef(defs Definitions, def *ast.Definition) *ast.Definition
- func AggregatedQueryDef(field *ast.Field) *ast.FieldDefinition
- func Compile(source *ast.SchemaDocument, opt Options) (*ast.Schema, error)
- func CompileExtension(schema *ast.Schema, extension *ast.SchemaDocument, opt Options) (*ast.Schema, *ast.SchemaDocument, []string, error)
- func CompiledPosName(name string) *ast.Position
- func DataObjectType(def *ast.Definition) string
- func DirectiveArgChildValues(d *ast.Directive, name string, vars map[string]any) []string
- func DirectiveArgValue(d *ast.Directive, name string, vars map[string]any) string
- func ErrorPosf(pos *ast.Position, format string, args ...interface{}) *gqlerror.Error
- func ExtractFieldsFromSQL(sql string) []string
- func IsAggregateQuery(field *ast.Field) bool
- func IsBucketAggregateQuery(field *ast.Field) bool
- func IsDataObject(def *ast.Definition) bool
- func IsDeleteQuery(field *ast.Field) bool
- func IsEqualTypes(a, b *ast.Type) bool
- func IsExtraField(def *ast.FieldDefinition) bool
- func IsFunction(field *ast.FieldDefinition) bool
- func IsFunctionCall(field *ast.FieldDefinition) bool
- func IsFunctionCallQuery(field *ast.Field) bool
- func IsFunctionCallSubquery(field *ast.Field) bool
- func IsHyperTable(def *ast.Definition) bool
- func IsInsertQuery(field *ast.Field) bool
- func IsJSONType(typeName string) bool
- func IsJoinSubquery(field *ast.Field) bool
- func IsReferencesSubquery(field *ast.FieldDefinition) bool
- func IsScalarAggregationType(typeName string) bool
- func IsScalarType(typeName string) bool
- func IsSelectOneQuery(field *ast.Field) bool
- func IsSelectQuery(field *ast.Field) bool
- func IsSubQuery(field *ast.FieldDefinition) bool
- func IsSystemType(def *ast.Definition) bool
- func IsTableFuncJoin(field *ast.FieldDefinition) bool
- func IsTableFuncJoinSubquery(field *ast.Field) bool
- func IsTimescaleKey(def *ast.FieldDefinition) bool
- func IsUpdateQuery(field *ast.Field) bool
- func MergeSchema(schemas ...*ast.Schema) (*ast.SchemaDocument, error)
- func NewFunction(module, name, sql string, t *ast.Type, isTable, jsonCast bool, ...) *ast.FieldDefinition
- func ObjectSQL(def *ast.Definition) string
- func ParseArgumentValue(defs Definitions, arg *ast.ArgumentDefinition, value *ast.Value, ...) (any, error)
- func ParseDataAsInputObject(defs Definitions, inputType *ast.Type, data any, checkRequired bool) (any, error)
- func QueryRequestInfo(ss ast.SelectionSet) ([]QueryRequest, QueryType)
- func RemoveFieldsDuplicates(fields []string) []string
- func SpecifiedByURL(def *ast.Definition) string
- func TransformBaseFieldType(field *ast.FieldDefinition) string
- type Definitions
- type DefinitionsSource
- type Deprecated
- type Field
- func (f *Field) Definition() *ast.FieldDefinition
- func (f *Field) FieldSourceName(prefix string, ident bool) string
- func (f *Field) GeometrySRID() string
- func (f *Field) IsCalcField() bool
- func (f *Field) IsGeometry() bool
- func (f *Field) IsNotDBField() bool
- func (f *Field) IsReferencesSubquery() bool
- func (f *Field) IsRequired() bool
- func (f *Field) IsTransformed() bool
- func (f *Field) SQL(prefix string) string
- func (f *Field) SequenceName() string
- func (f *Field) TransformSQL(sql string) string
- func (f *Field) UsingFields() []string
- type FieldQueryArgument
- type FieldQueryArguments
- type Function
- type FunctionCall
- func (f *FunctionCall) ArgumentMap() map[string]string
- func (f *FunctionCall) ArgumentValues(defs Definitions, vars map[string]any) (FieldQueryArguments, error)
- func (f *FunctionCall) FunctionInfo(defs Definitions) (*Function, error)
- func (f *FunctionCall) JoinConditionsTemplate() string
- func (f *FunctionCall) ReferencesFields() []string
- func (f *FunctionCall) SourceFields() ([]string, error)
- type Join
- type ModuleObjectType
- type ModuleRoot
- type Mutation
- func (m *Mutation) DBFieldName(name string) string
- func (m *Mutation) DefaultSequencesValues() map[string]string
- func (m *Mutation) FieldDefinition(name string) *ast.FieldDefinition
- func (m *Mutation) Fields() []*Field
- func (m *Mutation) M2MReferencesFields() []string
- func (m *Mutation) ReferencesFields() []string
- func (m Mutation) ReferencesFieldsReferences(name string) []string
- func (m Mutation) ReferencesFieldsSource(name string) []string
- func (m *Mutation) ReferencesMutation(name string) *Mutation
- func (m *Mutation) SelectByPKQuery(query *ast.Field) *ast.Field
- type Object
- func (info *Object) ApplyArguments(defs Definitions, args map[string]any, builder sqlBuilder) (err error)
- func (info *Object) Definition() *ast.Definition
- func (info *Object) FieldForName(name string) *Field
- func (info *Object) HasArguments() bool
- func (info *Object) InputFilterName() string
- func (info *Object) InputInsertDataName() string
- func (info *Object) M2MReferencesQueryInfo(defs Definitions, name string) *References
- func (info *Object) ReferencesQueryInfo(defs Definitions, name string) *References
- func (info *Object) ReferencesQueryInfoByName(defs Definitions, name string) *References
- func (info *Object) SQL(ctx context.Context, prefix string) string
- func (info *Object) SoftDeleteCondition(prefix string) string
- func (info *Object) SoftDeleteSet(prefix string) string
- type ObjectMutationType
- type ObjectQueryType
- type Options
- type QueryRequest
- type QueryType
- type References
- func (info *References) FromM2MJoinConditions(defs Definitions, m2mAlias, rightAlias string, isDBLeft, isDBRight bool) (string, error)
- func (info *References) JoinConditions(defs Definitions, leftAlias, rightAlias string, isDBLeft, isDBRight bool) (string, error)
- func (info *References) ReferencesFields() []string
- func (info *References) ReferencesObjectDef(defs Definitions) *ast.Definition
- func (info *References) SourceFields() []string
- func (info *References) ToM2MJoinConditions(defs Definitions, leftAlias, m2mAlias string, isDBLeft, isDBRight bool) (string, error)
- type ScalarType
- type Unique
Constants ¶
View Source
const ( AggregateKeyFieldName = "key" AggregateFieldName = "aggregations" AggRowsCountFieldName = "_rows_count" AggregationSuffix = "_aggregation" BucketAggregationSuffix = "_bucket_aggregation" )
View Source
const ( QueryTimeJoinsFieldName = "_join" QueryTimeJoinsTypeName = "_join" QueryTimeSpatialFieldName = "_spatial" QueryTimeSpatialTypeName = "_spatial" )
View Source
const ( FieldMeasurementDirectiveName = "measurement" FieldMeasurementFuncArgName = "measurement_func" )
View Source
const ( OperationResultTypeName = "OperationResult" ObjectQueryByPKSuffix = "_by_pk" )
View Source
const ( TableDataObject = "table" ViewDataObject = "view" )
View Source
const ( JoinSourceFieldPrefix = "source" JoinRefFieldPrefix = "dest" )
View Source
const ( MetadataSchemaQuery = "__schema" MetadataTypeQuery = "__type" MetadataTypeNameQuery = "__typename" JQTransformQueryName = "jq" )
View Source
const ( JSONTypeName = "JSON" TimestampTypeName = "Timestamp" GeometryTypeName = "Geometry" GeometryAggregationTypeName = "GeometryAggregation" GeometryMeasurementExtraFieldName = "Measurement" TimestampExtractExtraFieldName = "Extract" )
View Source
const ( Table = "table" View = "view" )
View Source
const DeprecatedDirectiveName = "deprecated"
View Source
const (
JoinDirectiveName = "join"
)
Variables ¶
View Source
var FieldJSONTypes = map[string]string{
"String": "string",
"Int": "number",
"BigInt": "number",
"Float": "number",
"Boolean": "bool",
"Date": "timestamp",
"Timestamp": "timestamp",
"Time": "timestamp",
"StringAggregation": "string",
"IntAggregation": "number",
"BigIntAggregation": "number",
"FloatAggregation": "number",
"BooleanAggregation": "bool",
"DateAggregation": "timestamp",
"TimestampAggregation": "timestamp",
"TimeAggregation": "timestamp",
"StringSubAggregation": "",
"IntSubAggregation": "",
"BigIntSubAggregation": "",
"FloatSubAggregation": "",
"BooleanSubAggregation": "",
"DateSubAggregation": "",
"TimestampSubAggregation": "",
"TimeSubAggregation": "",
"JSONSubAggregation": "",
"GeometrySubAggregation": "",
}
View Source
var MeasurementAggregations = map[string]string{
"MIN": "min",
"MAX": "max",
"SUM": "sum",
"AVG": "avg",
"ANY": "any",
}
View Source
var ScalarTypes = map[string]ScalarType{ "String": { Name: "String", Description: "String type", JSONType: "string", JSONToStructType: "VARCHAR", JSONNativeType: "VARCHAR", FilterInput: "StringFilter", ListFilterInput: "StringListFilter", ParseArray: func(value any) (any, error) { return types.ParseScalarArray[string](value) }, AggType: "StringAggregation", MeasurementAggs: "StringMeasurementAggregation", }, "Int": { Name: "Int", Description: "Int type", JSONType: "number", JSONToStructType: "INTEGER", JSONNativeType: "INTEGER", FilterInput: "IntFilter", ListFilterInput: "IntListFilter", ParseValue: func(value any) (any, error) { switch v := value.(type) { case int: return int64(v), nil case int32: return int64(v), nil case int64: return v, nil case float64: return int64(v), nil } return nil, fmt.Errorf("unexpected type %T for BigInt", value) }, ParseArray: func(value any) (any, error) { return types.ParseScalarArray[int64](value) }, AggType: "IntAggregation", MeasurementAggs: "IntMeasurementAggregation", }, "BigInt": { Name: "BigInt", Description: "BigInt type", JSONType: "number", JSONToStructType: "BIGINT", JSONNativeType: "BIGINT", FilterInput: "BigIntFilter", ListFilterInput: "BigIntListFilter", ParseValue: func(value any) (any, error) { switch v := value.(type) { case int: return int64(v), nil case int32: return int64(v), nil case int64: return v, nil case float64: return int64(v), nil } return nil, fmt.Errorf("unexpected type %T for BigInt", value) }, ParseArray: func(value any) (any, error) { return types.ParseScalarArray[int64](value) }, AggType: "BigIntAggregation", MeasurementAggs: "BigIntMeasurementAggregation", }, "Float": { Name: "Float", Description: "Float type", JSONType: "number", JSONToStructType: "FLOAT", JSONNativeType: "FLOAT", FilterInput: "FloatFilter", ListFilterInput: "FloatListFilter", ParseValue: func(value any) (any, error) { switch v := value.(type) { case int: return float64(v), nil case int32: return float64(v), nil case int64: return float64(v), nil case float64: return v, nil } return nil, fmt.Errorf("unexpected type %T for Float", value) }, ParseArray: func(value any) (any, error) { return types.ParseScalarArray[float64](value) }, AggType: "FloatAggregation", MeasurementAggs: "FloatMeasurementAggregation", }, "Boolean": { Name: "Boolean", Description: "Boolean type", JSONType: "bool", JSONToStructType: "BOOLEAN", JSONNativeType: "BOOLEAN", FilterInput: "BooleanFilter", ParseArray: func(value any) (any, error) { return types.ParseScalarArray[bool](value) }, AggType: "BooleanAggregation", MeasurementAggs: "BooleanMeasurementAggregation", }, "Date": { Name: "Date", Description: "Date type", JSONType: "timestamp", JSONToStructType: "DATE", JSONNativeType: "VARCHAR", FilterInput: "DateFilter", ListFilterInput: "DateListFilter", ParseValue: func(value any) (any, error) { return types.ParseTimeValue(value) }, ParseArray: func(value any) (any, error) { return types.ParseScalarArray[time.Time](value) }, AggType: "DateAggregation", MeasurementAggs: "DateMeasurementAggregation", }, "Timestamp": { Name: "Timestamp", Description: "Timestamp type", Arguments: ast.ArgumentDefinitionList{ { Name: "bucket", Description: "Truncate ti the specified part of the timestamp. " + "Possible values: 'year', 'month', 'day', 'hour', 'minute', 'second'.", Type: ast.NamedType("TimeBucket", compiledPos()), Position: compiledPos(), }, { Name: "bucket_interval", Description: "Extracts the specified part of the timestamp", Type: ast.NamedType("Interval", compiledPos()), Position: compiledPos(), }, }, ExtraField: func(field *ast.FieldDefinition) *ast.FieldDefinition { fieldName := "_" + field.Name + "_part" if strings.HasPrefix(field.Name, "_") { fieldName = strings.TrimPrefix(field.Name, "_") } sql := "[" + field.Name + "]" return &ast.FieldDefinition{ Name: fieldName, Description: field.Description + " (extracted part)", Arguments: ast.ArgumentDefinitionList{ { Name: "extract", Description: "Extracts the specified part of the timestamp", Type: ast.NonNullNamedType("TimeExtract", compiledPos()), Position: compiledPos(), }, { Name: "extract_divide", Description: "Divides the extracted value", Type: ast.NamedType("Int", compiledPos()), Position: compiledPos(), }, }, Directives: ast.DirectiveList{ base.SqlFieldDirective(sql), base.ExtraFieldDirective(TimestampExtractExtraFieldName, TimestampTypeName), }, Type: ast.NamedType("BigInt", compiledPos()), } }, JSONToStructType: "TIMESTAMP", JSONNativeType: "VARCHAR", JSONType: "timestamp", FilterInput: "TimestampFilter", ListFilterInput: "TimestampListFilter", ParseValue: func(value any) (any, error) { return types.ParseTimeValue(value) }, ParseArray: func(value any) (any, error) { return types.ParseScalarArray[time.Time](value) }, AggType: "TimestampAggregation", MeasurementAggs: "TimestampMeasurementAggregation", }, "Time": { Name: "Time", Description: "Time type", JSONType: "timestamp", JSONToStructType: "TIME", JSONNativeType: "VARCHAR", FilterInput: "TimeFilter", ListFilterInput: "TimeListFilter", ParseValue: func(value any) (any, error) { return types.ParseTimeValue(value) }, ParseArray: func(value any) (any, error) { return types.ParseScalarArray[time.Time](value) }, AggType: "TimeAggregation", MeasurementAggs: "TimeMeasurementAggregation", }, "Interval": { Name: "Interval", Description: "Interval type (duration)", JSONType: "string", JSONToStructType: "INTERVAL", JSONNativeType: "VARCHAR", FilterInput: "IntervalFilter", ListFilterInput: "IntervalListFilter", ParseValue: func(value any) (any, error) { return types.ParseIntervalValue(value) }, ParseArray: func(value any) (any, error) { vv, err := types.ParseScalarArray[string](value) if err != nil { return nil, err } out := make([]time.Duration, len(vv)) for i, v := range vv { r, err := types.ParseIntervalValue(v) if err != nil { return nil, err } out[i] = r } return out, nil }, }, "JSON": { Name: "JSON", Description: "JSON type", Arguments: ast.ArgumentDefinitionList{ { Name: "struct", Description: "Provides json structure to extract partial data from json field." + "Structure: {field: \"type\", field2: [\"type2\"], field3: [{field4: \"type4\"}]}.", Type: ast.NamedType("JSON", compiledPos()), Position: compiledPos(), }, }, JSONToStructType: "JSON", JSONNativeType: "JSON", FilterInput: "JSONFilter", ParseValue: func(value any) (any, error) { return types.ParseJsonValue(value) }, AggType: "JSONAggregation", }, "IntRange": { Name: "IntRange", Description: "IntRange type", JSONToStructType: "VARCHAR", JSONNativeType: "VARCHAR", FilterInput: "IntRangeFilter", ListFilterInput: "IntRangeListFilter", ParseValue: func(value any) (any, error) { return types.ParseRangeValue(types.RangeTypeInt32, value) }, ParseArray: func(value any) (any, error) { vv, err := types.ParseScalarArray[string](value) if err != nil { return nil, err } out := make([]types.Int32Range, len(vv)) for i, v := range vv { r, err := types.ParseRangeValue(types.RangeTypeInt32, v) if err != nil { return nil, err } out[i] = r.(types.Int32Range) } return out, nil }, }, "BigIntRange": { Name: "Int8Range", Description: "Int8Range type", JSONToStructType: "VARCHAR", JSONNativeType: "VARCHAR", FilterInput: "BigIntRangeFilter", ListFilterInput: "BigIntRangeListFilter", ParseValue: func(value any) (any, error) { return types.ParseRangeValue(types.RangeTypeInt64, value) }, ParseArray: func(value any) (any, error) { vv, err := types.ParseScalarArray[string](value) if err != nil { return nil, err } out := make([]types.Int64Range, len(vv)) for i, v := range vv { r, err := types.ParseRangeValue(types.RangeTypeInt64, v) if err != nil { return nil, err } out[i] = r.(types.Int64Range) } return out, nil }, }, "TimestampRange": { Name: "TimestampRange", Description: "TimestampRange type", JSONToStructType: "VARCHAR", JSONNativeType: "VARCHAR", FilterInput: "TimestampRangeFilter", ListFilterInput: "TimestampRangeListFilter", ParseValue: func(value any) (any, error) { return types.ParseRangeValue(types.RangeTypeTimestamp, value) }, ParseArray: func(value any) (any, error) { vv, err := types.ParseScalarArray[string](value) if err != nil { return nil, err } out := make([]types.TimeRange, len(vv)) for i, v := range vv { r, err := types.ParseRangeValue(types.RangeTypeTimestamp, v) if err != nil { return nil, err } out[i] = r.(types.TimeRange) } return out, nil }, }, "Geometry": { Name: "Geometry", Description: "Geometry type", Arguments: ast.ArgumentDefinitionList{ { Name: "transforms", Description: "Provides function to transform geometry", Type: ast.ListType(ast.NonNullNamedType("GeometryTransform", compiledPos()), compiledPos()), Position: compiledPos(), }, { Name: "from", Description: "Converts geometry from the specified SRID", Type: ast.NamedType("Int", compiledPos()), Position: compiledPos(), }, { Name: "to", Description: "Converts geometry to the specified SRID", Type: ast.NamedType("Int", compiledPos()), Position: compiledPos(), }, { Name: "buffer", Description: "Expands the geometry by the specified distance", Type: ast.NamedType("Float", compiledPos()), Position: compiledPos(), }, { Name: "simplify_factor", Description: "Simplifies the geometry by the specified factor", Type: ast.NamedType("Float", compiledPos()), }, }, ExtraField: func(field *ast.FieldDefinition) *ast.FieldDefinition { fieldName := "_" + field.Name + "_measurement" if strings.HasPrefix(field.Name, "_") { fieldName = strings.TrimPrefix(field.Name, "_") } sql := "[" + field.Name + "]" return &ast.FieldDefinition{ Name: fieldName, Description: field.Description + " (geometry measurement)", Arguments: ast.ArgumentDefinitionList{ { Name: "type", Description: "Measurement type", Type: ast.NonNullNamedType("GeometryMeasurementTypes", compiledPos()), Position: compiledPos(), }, { Name: "transform", Description: "Reproject geometry (parameters from and to is required)", Type: ast.NamedType("Boolean", compiledPos()), Position: compiledPos(), }, { Name: "from", Description: "Converts geometry from the specified SRID", Type: ast.NamedType("Int", compiledPos()), Position: compiledPos(), }, { Name: "to", Description: "Converts geometry to the specified SRID", Type: ast.NamedType("Int", compiledPos()), Position: compiledPos(), }, }, Directives: ast.DirectiveList{ base.SqlFieldDirective(sql), base.ExtraFieldDirective(GeometryMeasurementExtraFieldName, GeometryTypeName), }, Type: ast.NamedType("Float", compiledPos()), } }, JSONToStructType: "JSON", JSONNativeType: "VARCHAR", FilterInput: "GeometryFilter", ParseValue: func(value any) (any, error) { return types.ParseGeometryValue(value) }, AggType: "GeometryAggregation", }, }
Functions ¶
func AddExtensions ¶
func AddExtensions(origin *ast.SchemaDocument, extension *ast.SchemaDocument) (*ast.Schema, error)
graphql extensions can contains new types and fields it can't add new directives to the existing types fields can have only additional join/function_call/table_function_call_join directives
func AggregatedObjectDef ¶
func AggregatedObjectDef(defs Definitions, def *ast.Definition) *ast.Definition
func AggregatedQueryDef ¶
func AggregatedQueryDef(field *ast.Field) *ast.FieldDefinition
func CompileExtension ¶ added in v0.1.12
func CompileExtension(schema *ast.Schema, extension *ast.SchemaDocument, opt Options) (*ast.Schema, *ast.SchemaDocument, []string, error)
CompileExtension validates the given extension schema document against the base schema. It checks for duplicate definitions, directive usage, and type compatibility. It returns the validated extension schema document, a list of depended catalogs, and an error if any validation fails.
func CompiledPosName ¶
func DataObjectType ¶
func DataObjectType(def *ast.Definition) string
func DirectiveArgChildValues ¶
func DirectiveArgValue ¶
func ExtractFieldsFromSQL ¶
func IsAggregateQuery ¶
func IsBucketAggregateQuery ¶
func IsDataObject ¶
func IsDataObject(def *ast.Definition) bool
func IsDeleteQuery ¶
func IsEqualTypes ¶
func IsExtraField ¶
func IsExtraField(def *ast.FieldDefinition) bool
func IsFunction ¶
func IsFunction(field *ast.FieldDefinition) bool
func IsFunctionCall ¶
func IsFunctionCall(field *ast.FieldDefinition) bool
func IsFunctionCallQuery ¶
func IsFunctionCallSubquery ¶
func IsHyperTable ¶
func IsHyperTable(def *ast.Definition) bool
func IsInsertQuery ¶
func IsJSONType ¶
func IsJoinSubquery ¶
func IsReferencesSubquery ¶
func IsReferencesSubquery(field *ast.FieldDefinition) bool
func IsScalarAggregationType ¶
func IsScalarType ¶
func IsSelectOneQuery ¶
func IsSelectQuery ¶
func IsSubQuery ¶
func IsSubQuery(field *ast.FieldDefinition) bool
func IsSystemType ¶
func IsSystemType(def *ast.Definition) bool
func IsTableFuncJoin ¶
func IsTableFuncJoin(field *ast.FieldDefinition) bool
func IsTableFuncJoinSubquery ¶
func IsTimescaleKey ¶
func IsTimescaleKey(def *ast.FieldDefinition) bool
func IsUpdateQuery ¶
func MergeSchema ¶
func MergeSchema(schemas ...*ast.Schema) (*ast.SchemaDocument, error)
MergeSchema merges the given schemas to one common schema. Not system type names should be unique, except module query/mutation root objects.
func NewFunction ¶
func NewFunction(module, name, sql string, t *ast.Type, isTable, jsonCast bool, args ast.ArgumentDefinitionList, pos *ast.Position) *ast.FieldDefinition
func ObjectSQL ¶
func ObjectSQL(def *ast.Definition) string
func ParseArgumentValue ¶
func ParseArgumentValue(defs Definitions, arg *ast.ArgumentDefinition, value *ast.Value, vars map[string]any, checkRequired bool) (any, error)
func ParseDataAsInputObject ¶
func QueryRequestInfo ¶
func QueryRequestInfo(ss ast.SelectionSet) ([]QueryRequest, QueryType)
func RemoveFieldsDuplicates ¶
func SpecifiedByURL ¶
func SpecifiedByURL(def *ast.Definition) string
func TransformBaseFieldType ¶
func TransformBaseFieldType(field *ast.FieldDefinition) string
Types ¶
type Definitions ¶
type Definitions interface {
ForName(name string) *ast.Definition
}
type DefinitionsSource ¶
type DefinitionsSource interface { Definitions DirectiveForName(name string) *ast.DirectiveDefinition }
func SchemaDefs ¶
func SchemaDefs(schema *ast.Schema) DefinitionsSource
type Deprecated ¶
func EnumDeprecatedInfo ¶
func EnumDeprecatedInfo(def *ast.EnumValueDefinition) Deprecated
func FieldDeprecatedInfo ¶
func FieldDeprecatedInfo(def *ast.FieldDefinition) Deprecated
type Field ¶
type Field struct { Name string // contains filtered or unexported fields }
func (*Field) Definition ¶
func (f *Field) Definition() *ast.FieldDefinition
func (*Field) GeometrySRID ¶
func (*Field) IsCalcField ¶
func (*Field) IsGeometry ¶
func (*Field) IsNotDBField ¶
func (*Field) IsReferencesSubquery ¶
func (*Field) IsRequired ¶
func (*Field) IsTransformed ¶
func (*Field) SequenceName ¶
func (*Field) TransformSQL ¶
func (*Field) UsingFields ¶
extract using fields from sql query
type FieldQueryArguments ¶
type FieldQueryArguments []FieldQueryArgument
func ArgumentValues ¶
func ArgumentValues(defs Definitions, field *ast.Field, vars map[string]any, checkRequired bool) (FieldQueryArguments, error)
func (FieldQueryArguments) ForName ¶
func (a FieldQueryArguments) ForName(name string) *FieldQueryArgument
type Function ¶
type Function struct { Module string Catalog string Name string ReturnsTable bool JsonCast bool SkipNullArg bool // contains filtered or unexported fields }
func FunctionInfo ¶
func FunctionInfo(field *ast.FieldDefinition) (*Function, error)
func (*Function) ArgumentByName ¶
func (f *Function) ArgumentByName(name string) *ast.ArgumentDefinition
type FunctionCall ¶
type FunctionCall struct { IsTableFuncJoin bool // contains filtered or unexported fields }
func FunctionCallInfo ¶
func FunctionCallInfo(field *ast.Field) *FunctionCall
func (*FunctionCall) ArgumentMap ¶
func (f *FunctionCall) ArgumentMap() map[string]string
func (*FunctionCall) ArgumentValues ¶
func (f *FunctionCall) ArgumentValues(defs Definitions, vars map[string]any) (FieldQueryArguments, error)
func (*FunctionCall) FunctionInfo ¶
func (f *FunctionCall) FunctionInfo(defs Definitions) (*Function, error)
func (*FunctionCall) JoinConditionsTemplate ¶
func (f *FunctionCall) JoinConditionsTemplate() string
func (*FunctionCall) ReferencesFields ¶
func (f *FunctionCall) ReferencesFields() []string
func (*FunctionCall) SourceFields ¶
func (f *FunctionCall) SourceFields() ([]string, error)
type Join ¶
type Join struct { ReferencesName string SQL string IsQueryTime bool // contains filtered or unexported fields }
func (*Join) Catalog ¶
func (j *Join) Catalog(defs Definitions) string
func (*Join) JoinConditionsTemplate ¶
func (*Join) ReferencesFields ¶
func (*Join) SourceFields ¶
type ModuleObjectType ¶
type ModuleObjectType int
const ( ModuleQuery ModuleObjectType = iota + 1 ModuleMutation ModuleFunction ModuleMutationFunction )
type ModuleRoot ¶
type ModuleRoot struct { Name string Type ModuleObjectType }
func ModuleRootInfo ¶
func ModuleRootInfo(def *ast.Definition) *ModuleRoot
type Mutation ¶
type Mutation struct { ObjectName string Catalog string Type ObjectMutationType ObjectDefinition *ast.Definition // contains filtered or unexported fields }
func MutationInfo ¶
func MutationInfo(defs Definitions, query *ast.FieldDefinition) *Mutation
func (*Mutation) DBFieldName ¶
func (*Mutation) DefaultSequencesValues ¶
func (*Mutation) FieldDefinition ¶
func (m *Mutation) FieldDefinition(name string) *ast.FieldDefinition
func (*Mutation) M2MReferencesFields ¶
func (*Mutation) ReferencesFields ¶
func (Mutation) ReferencesFieldsReferences ¶
func (Mutation) ReferencesFieldsSource ¶
func (*Mutation) ReferencesMutation ¶
type Object ¶
type Object struct { Name string Type string Catalog string SoftDelete bool IsCube bool // contains filtered or unexported fields }
func DataObjectInfo ¶
func DataObjectInfo(def *ast.Definition) *Object
func (*Object) ApplyArguments ¶ added in v0.1.5
func (info *Object) ApplyArguments(defs Definitions, args map[string]any, builder sqlBuilder) (err error)
func (*Object) Definition ¶
func (info *Object) Definition() *ast.Definition
func (*Object) FieldForName ¶
func (*Object) HasArguments ¶ added in v0.1.5
func (*Object) InputFilterName ¶
func (*Object) InputInsertDataName ¶
func (*Object) M2MReferencesQueryInfo ¶
func (info *Object) M2MReferencesQueryInfo(defs Definitions, name string) *References
func (*Object) ReferencesQueryInfo ¶
func (info *Object) ReferencesQueryInfo(defs Definitions, name string) *References
func (*Object) ReferencesQueryInfoByName ¶
func (info *Object) ReferencesQueryInfoByName(defs Definitions, name string) *References
func (*Object) SoftDeleteCondition ¶
func (*Object) SoftDeleteSet ¶
type ObjectMutationType ¶
type ObjectMutationType int
const ( MutationTypeInsert ObjectMutationType = iota MutationTypeUpdate MutationTypeDelete )
type ObjectQueryType ¶
type ObjectQueryType int
const ( QueryTypeSelect ObjectQueryType = iota QueryTypeSelectOne QueryTypeAggregate QueryTypeAggregateBucket SubQueryTypeReferencesData SubQueryTypeJoinData SubQueryTypeFunctionCallData SubQueryTypeFunctionCallTableJoinData )
type QueryRequest ¶
type References ¶
type References struct { Name string ReferencesName string Query string Description string ReferencesQuery string ReferencesDescription string IsM2M bool M2MName string // contains filtered or unexported fields }
func FieldReferencesInfo ¶
func FieldReferencesInfo(defs Definitions, def *ast.Definition, field *ast.FieldDefinition) *References
func ReferencesInfo ¶
func ReferencesInfo(def *ast.Directive) *References
func (*References) FromM2MJoinConditions ¶
func (info *References) FromM2MJoinConditions(defs Definitions, m2mAlias, rightAlias string, isDBLeft, isDBRight bool) (string, error)
func (*References) JoinConditions ¶
func (info *References) JoinConditions(defs Definitions, leftAlias, rightAlias string, isDBLeft, isDBRight bool) (string, error)
func (*References) ReferencesFields ¶
func (info *References) ReferencesFields() []string
func (*References) ReferencesObjectDef ¶
func (info *References) ReferencesObjectDef(defs Definitions) *ast.Definition
func (*References) SourceFields ¶
func (info *References) SourceFields() []string
func (*References) ToM2MJoinConditions ¶
func (info *References) ToM2MJoinConditions(defs Definitions, leftAlias, m2mAlias string, isDBLeft, isDBRight bool) (string, error)
type ScalarType ¶
type ScalarType struct { Name string Description string Arguments ast.ArgumentDefinitionList ExtraField func(field *ast.FieldDefinition) *ast.FieldDefinition JSONType string JSONToStructType string JSONNativeType string FilterInput string ListFilterInput string ParseValue func(value any) (any, error) ParseArray func(value any) (any, error) AggType string MeasurementAggs string }
Source Files
¶
Click to show internal directories.
Click to hide internal directories.