sdl

package
v0.3.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 7, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ModuleQuery            = base.ModuleQuery
	ModuleMutation         = base.ModuleMutation
	ModuleFunction         = base.ModuleFunction
	ModuleMutationFunction = base.ModuleMutationFunction
)
View Source
const (
	TableDataObject = base.TableDataObject
	ViewDataObject  = base.ViewDataObject
)
View Source
const (
	QueryTypeSelect                       = base.QueryTypeSelect
	QueryTypeSelectOne                    = base.QueryTypeSelectOne
	QueryTypeAggregate                    = base.QueryTypeAggregate
	QueryTypeAggregateBucket              = base.QueryTypeAggregateBucket
	SubQueryTypeReferencesData            = base.SubQueryTypeReferencesData
	SubQueryTypeJoinData                  = base.SubQueryTypeJoinData
	SubQueryTypeFunctionCallData          = base.SubQueryTypeFunctionCallData
	SubQueryTypeFunctionCallTableJoinData = base.SubQueryTypeFunctionCallTableJoinData
)
View Source
const (
	MutationTypeInsert = base.MutationTypeInsert
	MutationTypeUpdate = base.MutationTypeUpdate
	MutationTypeDelete = base.MutationTypeDelete
)
View Source
const (
	QueryTypeNone             = base.QueryTypeNone
	QueryTypeMeta             = base.QueryTypeMeta
	QueryTypeQuery            = base.QueryTypeQuery
	QueryTypeJQTransform      = base.QueryTypeJQTransform
	QueryTypeMutation         = base.QueryTypeMutation
	QueryTypeFunction         = base.QueryTypeFunction
	QueryTypeFunctionMutation = base.QueryTypeFunctionMutation
	QueryTypeH3Aggregation    = base.QueryTypeH3Aggregation
)
View Source
const (
	MetadataSchemaQuery   = base.MetadataSchemaQuery
	MetadataTypeQuery     = base.MetadataTypeQuery
	MetadataTypeNameQuery = base.MetadataTypeNameQuery
	JQTransformQueryName  = base.JQTransformQueryName
)

Variables

View Source
var ErrorPosf = base.ErrorPosf
View Source
var JSONTypeHint = types.JSONTypeHintWithOk

JSONTypeHint returns the JSON extraction type hint for a type name and whether the type is known. Delegates to the scalar type registry.

View Source
var ModuleRootInfo = base.ModuleRootInfo
View Source
var ParseScalarArray = types.ParseArray

ParseScalarArray dispatches array parsing to the scalar type's ArrayParser interface.

View Source
var ParseScalarValue = types.ParseValue

ParseScalarValue dispatches value parsing to the scalar type's ValueParser interface.

Functions

func AggregatedObjectDef

func AggregatedObjectDef(ctx context.Context, defs base.DefinitionsSource, def *ast.Definition) *ast.Definition

func AggregatedQueryDef

func AggregatedQueryDef(field *ast.Field) *ast.FieldDefinition

func AggregatedQueryFieldName

func AggregatedQueryFieldName(def *ast.FieldDefinition) (string, bool)

func CatalogName

func CatalogName(def *ast.Definition) string

func DataObjectType

func DataObjectType(def *ast.Definition) string

func DirectiveArgChildValues

func DirectiveArgChildValues(d *ast.Directive, name string, vars map[string]any) []string

func DirectiveArgValue

func DirectiveArgValue(d *ast.Directive, name string, vars map[string]any) string

func ExtraFieldName

func ExtraFieldName(def *ast.FieldDefinition) string

func ExtractFieldsFromSQL

func ExtractFieldsFromSQL(sql string) []string

func FlatQuery

func FlatQuery(queries []QueryRequest) map[string]QueryRequest

func FunctionModule

func FunctionModule(def *ast.FieldDefinition) string

func HasSystemDirective

func HasSystemDirective(def ast.DirectiveList) bool

func IsAggregateQuery

func IsAggregateQuery(field *ast.Field) bool

func IsAggregateQueryDefinition

func IsAggregateQueryDefinition(def *ast.FieldDefinition) bool

func IsBucketAggregateQuery

func IsBucketAggregateQuery(field *ast.Field) bool

func IsBucketAggregateQueryDefinition

func IsBucketAggregateQueryDefinition(def *ast.FieldDefinition) bool

func IsDataObject

func IsDataObject(def *ast.Definition) bool

func IsDataObjectFieldDefinition

func IsDataObjectFieldDefinition(def *ast.FieldDefinition) bool

func IsDeleteQuery

func IsDeleteQuery(field *ast.Field) bool

func IsDeleteQueryDefinition

func IsDeleteQueryDefinition(def *ast.FieldDefinition) bool

func IsEmbeddedObject

func IsEmbeddedObject(def *ast.Definition) bool

func IsEqualTypes

func IsEqualTypes(a, b *ast.Type) bool

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 IsFunctionCallQuery(field *ast.Field) bool

func IsFunctionCallSubquery

func IsFunctionCallSubquery(field *ast.Field) bool

func IsFunctionCallSubqueryDefinition

func IsFunctionCallSubqueryDefinition(def *ast.FieldDefinition) bool

func IsH3Query

func IsH3Query(field *ast.Field) bool

func IsHyperTable

func IsHyperTable(def *ast.Definition) bool

func IsInsertQuery

func IsInsertQuery(field *ast.Field) bool

func IsInsertQueryDefinition

func IsInsertQueryDefinition(def *ast.FieldDefinition) bool

func IsJSONType

func IsJSONType(typeName string) bool

IsJSONType returns true if typeName is JSON.

func IsJoinSubquery

func IsJoinSubquery(field *ast.Field) bool

func IsJoinSubqueryDefinition

func IsJoinSubqueryDefinition(def *ast.FieldDefinition) bool

func IsNoJoinPushdown

func IsNoJoinPushdown(field *ast.Field) bool

func IsNoJoinPushdownDefinition

func IsNoJoinPushdownDefinition(def *ast.FieldDefinition) bool

func IsReferencesSubquery

func IsReferencesSubquery(field *ast.FieldDefinition) bool

func IsScalarType

func IsScalarType(typeName string) bool

IsScalarType returns true if typeName is a registered scalar type.

func IsSelectOneQuery

func IsSelectOneQuery(field *ast.Field) bool

func IsSelectOneQueryDefinition

func IsSelectOneQueryDefinition(def *ast.FieldDefinition) bool

func IsSelectQuery

func IsSelectQuery(field *ast.Field) bool

func IsSelectQueryDefinition

func IsSelectQueryDefinition(field *ast.FieldDefinition) bool

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 IsTableFuncJoinSubquery(field *ast.Field) bool

func IsTableFuncJoinSubqueryDefinition

func IsTableFuncJoinSubqueryDefinition(def *ast.FieldDefinition) bool

func IsTimescaleKey

func IsTimescaleKey(def *ast.FieldDefinition) bool

func IsUpdateQuery

func IsUpdateQuery(field *ast.Field) bool

func IsUpdateQueryDefinition

func IsUpdateQueryDefinition(def *ast.FieldDefinition) bool

func IsVectorSearchable

func IsVectorSearchable(def *ast.Definition) bool

func ModuleTypeName

func ModuleTypeName(module string, objectType base.ModuleObjectType) string

func NewFunction

func NewFunction(module, name, sql string, t *ast.Type, isTable, jsonCast bool, args ast.ArgumentDefinitionList, pos *ast.Position) *ast.FieldDefinition

func ObjectModule

func ObjectModule(def *ast.Definition) string

func ObjectMutationDefinition

func ObjectMutationDefinition(ctx context.Context, defs base.DefinitionsSource, def *ast.Definition, mutationType ObjectMutationType) (string, *ast.FieldDefinition)

func ObjectPrimaryKeys

func ObjectPrimaryKeys(def *ast.Definition) []string

func ObjectQueryDefinition

func ObjectQueryDefinition(ctx context.Context, defs base.DefinitionsSource, def *ast.Definition, queryType ObjectQueryType) (string, *ast.FieldDefinition)

func ObjectSQL

func ObjectSQL(def *ast.Definition) string

func ParseArgumentValue

func ParseArgumentValue(ctx context.Context, defs base.DefinitionsSource, arg *ast.ArgumentDefinition, value *ast.Value, vars map[string]any, checkRequired bool) (any, error)

ParseArgumentValue resolves and parses a GraphQL argument value, handling scalars, input objects, enums, lists, and variables.

func ParseDataAsInputObject

func ParseDataAsInputObject(ctx context.Context, defs base.DefinitionsSource, inputType *ast.Type, data any, checkRequired bool) (any, error)

ParseDataAsInputObject recursively parses map data into a validated input object, resolving scalar types along the way.

func QueryRequestInfo

func QueryRequestInfo(ss ast.SelectionSet) ([]QueryRequest, QueryType)

func RemoveFieldsDuplicates

func RemoveFieldsDuplicates(fields []string) []string

func SpecifiedByURL

func SpecifiedByURL(def *ast.Definition) string

SpecifiedByURL returns the specifiedBy URL from a scalar definition.

func ToOutputSQL

func ToOutputSQL(typeName, sql string, raw bool) string

ToOutputSQL applies output SQL transformation for a scalar type.

func ToStructFieldSQL

func ToStructFieldSQL(typeName, sql string) string

ToStructFieldSQL applies struct field SQL transformation for a scalar type.

func TransformBaseFieldType

func TransformBaseFieldType(field *ast.FieldDefinition) string

Types

type Deprecated

type Deprecated struct {
	IsDeprecated bool
	Reason       string
}

func EnumDeprecatedInfo

func EnumDeprecatedInfo(def *ast.EnumValueDefinition) Deprecated

func FieldDeprecatedInfo

func FieldDeprecatedInfo(def *ast.FieldDefinition) Deprecated

type Field

type Field struct {
	Name string

	Dim int
	// contains filtered or unexported fields
}

func FieldDefinitionInfo

func FieldDefinitionInfo(field *ast.FieldDefinition, object *ast.Definition) *Field

func FieldInfo

func FieldInfo(field *ast.Field) *Field

func (*Field) Definition

func (f *Field) Definition() *ast.FieldDefinition

func (*Field) FieldSourceName

func (f *Field) FieldSourceName(prefix string, ident bool) string

func (*Field) GeometrySRID

func (f *Field) GeometrySRID() string

func (*Field) IsCalcField

func (f *Field) IsCalcField() bool

func (*Field) IsGeometry

func (f *Field) IsGeometry() bool

func (*Field) IsNotDBField

func (f *Field) IsNotDBField() bool

func (*Field) IsReferencesSubquery

func (f *Field) IsReferencesSubquery() bool

func (*Field) IsRequired

func (f *Field) IsRequired() bool

func (*Field) IsTransformed

func (f *Field) IsTransformed() bool

func (*Field) SQL

func (f *Field) SQL(prefix string) string

func (*Field) SQLFieldFunc

func (f *Field) SQLFieldFunc(prefix string, fn func(string) string) string

func (*Field) SequenceName

func (f *Field) SequenceName() string

func (*Field) TransformSQL

func (f *Field) TransformSQL(sql string) string

func (*Field) UsingFields

func (f *Field) UsingFields() []string

type FieldQueryArgument

type FieldQueryArgument struct {
	Name  string
	Type  *ast.Type
	Value any
}

type FieldQueryArguments

type FieldQueryArguments []FieldQueryArgument

func ArgumentValues

func ArgumentValues(ctx context.Context, defs base.DefinitionsSource, field *ast.Field, vars map[string]any, checkRequired bool) (FieldQueryArguments, error)

func (FieldQueryArguments) ForName

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

func (*Function) Definition

func (f *Function) Definition() *ast.FieldDefinition

func (*Function) ResultAggregationType

func (f *Function) ResultAggregationType(ctx context.Context, defs base.DefinitionsSource) string

func (*Function) ResultBucketAggregationType

func (f *Function) ResultBucketAggregationType(ctx context.Context, defs base.DefinitionsSource) string

func (*Function) ResultSubAggregationType

func (f *Function) ResultSubAggregationType(ctx context.Context, defs base.DefinitionsSource) string

func (*Function) SQL

func (f *Function) SQL() string

type FunctionCall

type FunctionCall struct {
	ReferencesName string

	IsTableFuncJoin bool

	Module string
	// contains filtered or unexported fields
}

func FunctionCallDefinitionInfo

func FunctionCallDefinitionInfo(def *ast.FieldDefinition) *FunctionCall

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(ctx context.Context, defs base.DefinitionsSource, vars map[string]any) (FieldQueryArguments, error)

func (*FunctionCall) FunctionInfo

func (f *FunctionCall) FunctionInfo(ctx context.Context, defs base.DefinitionsSource) (*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 JoinDefinitionInfo

func JoinDefinitionInfo(def *ast.FieldDefinition) *Join

func JoinInfo

func JoinInfo(field *ast.Field) *Join

func (*Join) Catalog

func (j *Join) Catalog(ctx context.Context, defs base.DefinitionsSource) string

func (*Join) JoinConditionsTemplate

func (j *Join) JoinConditionsTemplate() string

func (*Join) ReferencesFields

func (j *Join) ReferencesFields() ([]string, error)

func (*Join) SourceFields

func (j *Join) SourceFields() ([]string, error)

type ModuleObjectType

type ModuleObjectType = base.ModuleObjectType

Type aliases re-exported from base.

type ModuleRoot

type ModuleRoot = base.ModuleRoot

type Mutation

type Mutation struct {
	ObjectName       string
	Catalog          string
	Type             ObjectMutationType
	ObjectDefinition *ast.Definition
	// contains filtered or unexported fields
}

func MutationInfo

func MutationInfo(ctx context.Context, defs base.DefinitionsSource, query *ast.FieldDefinition) *Mutation

func (*Mutation) AppendInsertSQLExpression

func (m *Mutation) AppendInsertSQLExpression(data map[string]string, vars map[string]any, builder sqlBuilder) error

func (*Mutation) AppendUpdateSQLExpression

func (m *Mutation) AppendUpdateSQLExpression(data map[string]string, vars map[string]any, builder sqlBuilder) error

func (*Mutation) DBFieldName

func (m *Mutation) DBFieldName(name string) string

func (*Mutation) DefaultSequencesValues

func (m *Mutation) DefaultSequencesValues() map[string]string

func (*Mutation) FieldDefinition

func (m *Mutation) FieldDefinition(name string) *ast.FieldDefinition

func (*Mutation) FieldHasDefaultInsertExpr

func (m *Mutation) FieldHasDefaultInsertExpr(name string) bool

func (*Mutation) FieldHasDefaultUpdateExpr

func (m *Mutation) FieldHasDefaultUpdateExpr(name string) bool

func (*Mutation) Fields

func (m *Mutation) Fields() []*Field

func (*Mutation) M2MReferencesFields

func (m *Mutation) M2MReferencesFields() []string

func (*Mutation) ReferencesFields

func (m *Mutation) ReferencesFields() []string

func (Mutation) ReferencesFieldsReferences

func (m Mutation) ReferencesFieldsReferences(name string) []string

func (Mutation) ReferencesFieldsSource

func (m Mutation) ReferencesFieldsSource(name string) []string

func (*Mutation) ReferencesMutation

func (m *Mutation) ReferencesMutation(name string) *Mutation

func (*Mutation) SelectByPKQuery

func (m *Mutation) SelectByPKQuery(query *ast.Field) *ast.Field

type Object

type Object struct {
	Name string

	Type       string
	Catalog    string
	SoftDelete bool
	IsM2M      bool

	IsCube       bool
	IsHypertable bool

	InputArgsName string
	RequiredArgs  bool
	HasVectors    bool
	// contains filtered or unexported fields
}

func DataObjectInfo

func DataObjectInfo(def *ast.Definition) *Object

func (*Object) AggregationTypeName

func (info *Object) AggregationTypeName(ctx context.Context, defs base.DefinitionsSource) string

func (*Object) ApplyArguments

func (info *Object) ApplyArguments(ctx context.Context, defs base.DefinitionsSource, args map[string]any, builder sqlBuilder) (err error)

func (*Object) BucketAggregationTypeName

func (info *Object) BucketAggregationTypeName(ctx context.Context, defs base.DefinitionsSource) string

func (*Object) Definition

func (info *Object) Definition() *ast.Definition

func (*Object) DeleteMutationName

func (info *Object) DeleteMutationName() string

func (*Object) FieldForName

func (info *Object) FieldForName(name string) *Field

func (*Object) HasArguments

func (info *Object) HasArguments() bool

func (*Object) InputFilterName

func (info *Object) InputFilterName() string

func (*Object) InputInsertDataName

func (info *Object) InputInsertDataName() string

func (*Object) InputUpdateDataName

func (info *Object) InputUpdateDataName() string

func (*Object) InsertMutationName

func (info *Object) InsertMutationName() string

func (*Object) M2MReferencesQueryInfo

func (info *Object) M2MReferencesQueryInfo(ctx context.Context, defs base.DefinitionsSource, name string) *References

func (*Object) Queries

func (info *Object) Queries() (queries []ObjectQuery)

func (*Object) ReferencesQueryInfo

func (info *Object) ReferencesQueryInfo(ctx context.Context, defs base.DefinitionsSource, name string) *References

func (*Object) ReferencesQueryInfoByName

func (info *Object) ReferencesQueryInfoByName(ctx context.Context, defs base.DefinitionsSource, name string) *References

func (*Object) SQL

func (info *Object) SQL(ctx context.Context, prefix string) string

func (*Object) SoftDeleteCondition

func (info *Object) SoftDeleteCondition(prefix string) string

func (*Object) SoftDeleteSet

func (info *Object) SoftDeleteSet(prefix string) string

func (*Object) SubAggregationTypeName

func (info *Object) SubAggregationTypeName(ctx context.Context, defs base.DefinitionsSource) string

func (*Object) UpdateMutationName

func (info *Object) UpdateMutationName() string

type ObjectMutationType

type ObjectMutationType = base.ObjectMutationType

type ObjectQuery

type ObjectQuery struct {
	Name string
	Type ObjectQueryType
}

type ObjectQueryType

type ObjectQueryType = base.ObjectQueryType

Type aliases re-exported from base.

type QueryRequest

type QueryRequest = base.QueryRequest

Type aliases re-exported from base.

type QueryType

type QueryType = base.QueryType

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(ctx context.Context, defs base.DefinitionsSource, def *ast.Definition, field *ast.FieldDefinition) *References

func ReferencesInfo

func ReferencesInfo(def *ast.Directive) *References

func (*References) FromM2MJoinConditions

func (info *References) FromM2MJoinConditions(ctx context.Context, defs base.DefinitionsSource, m2mAlias, rightAlias string, isDBLeft, isDBRight bool) (string, error)

func (*References) JoinConditions

func (info *References) JoinConditions(ctx context.Context, defs base.DefinitionsSource, leftAlias, rightAlias string, isDBLeft, isDBRight bool) (string, error)

func (*References) ReferencesFields

func (info *References) ReferencesFields() []string

func (*References) ReferencesObjectDef

func (info *References) ReferencesObjectDef(ctx context.Context, defs base.DefinitionsSource) *ast.Definition

func (*References) SourceFields

func (info *References) SourceFields() []string

func (*References) ToM2MJoinConditions

func (info *References) ToM2MJoinConditions(ctx context.Context, defs base.DefinitionsSource, leftAlias, m2mAlias string, isDBLeft, isDBRight bool) (string, error)

type Unique

type Unique struct {
	Fields      []string
	QuerySuffix string
	Skip        bool
	// contains filtered or unexported fields
}

func UniqueInfo

func UniqueInfo(def *ast.Directive) *Unique

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL