Documentation
¶
Index ¶
- Constants
- Variables
- func AddH3Directive(field string, resolution int, transformFrom int, buffer float64, ...) *ast.Directive
- func CloneArgument(arg *ast.Argument) *ast.Argument
- func CloneArgumentDefinitionList(args ast.ArgumentDefinitionList) ast.ArgumentDefinitionList
- func CloneArgumentList(args ast.ArgumentList) ast.ArgumentList
- func CloneDefinition(def *ast.Definition, fieldFilter func(*ast.FieldDefinition) bool) *ast.Definition
- func CloneDirective(dir *ast.Directive) *ast.Directive
- func CloneDirectiveList(dirs ast.DirectiveList) ast.DirectiveList
- func CloneEnumValueList(enumValues ast.EnumValueList) ast.EnumValueList
- func CloneFieldDefinition(field *ast.FieldDefinition) *ast.FieldDefinition
- func CloneFieldDefinitionListWithFilter(fields ast.FieldList, fieldFilter func(*ast.FieldDefinition) bool) ast.FieldList
- func CloneValue(value *ast.Value) *ast.Value
- func CompiledPos(name string) *ast.Position
- func DefinitionCatalog(def *ast.Definition) string
- func DefinitionDependencies(def *ast.Definition) []string
- func DefinitionDirectiveArgString(def *ast.Definition, dirName, argName string) string
- func DefinitionModuleCatalogs(def *ast.Definition) []string
- func DerivedExtensionFields(name, fieldName string) map[string][]string
- func DerivedTypeNames(name string) []string
- func DirectiveArgString(dir *ast.Directive, name string) string
- func DirectiveArgStrings(dir *ast.Directive, name string) []string
- func DropDirectiveIfExists(def *ast.Definition) bool
- func DropFieldIfExists(field *ast.FieldDefinition) bool
- func EnumValueCatalog(enumValue *ast.EnumValueDefinition) string
- func ErrorPosf(pos *ast.Position, format string, args ...any) *gqlerror.Error
- func FieldDefCatalog(field *ast.FieldDefinition) string
- func FieldDefDependency(field *ast.FieldDefinition) string
- func FieldDefDirectiveArgString(field *ast.FieldDefinition, dirName, argName string) string
- func FieldDefModuleCatalogs(field *ast.FieldDefinition) []string
- func FieldGeometryInfoDirective(geomType string, srid int) *ast.Directive
- func FieldSourceDirective(name string) *ast.Directive
- func FieldSqlDirective(sql string) *ast.Directive
- func Ident(s string) string
- func IsControlDirective(name string) bool
- func IsDropDefinition(def *ast.Definition) bool
- func IsDropEnumValue(ev *ast.EnumValueDefinition) bool
- func IsDropField(field *ast.FieldDefinition) bool
- func IsIfNotExistsDefinition(def *ast.Definition) bool
- func IsReplaceDefinition(def *ast.Definition) bool
- func IsReplaceField(field *ast.FieldDefinition) bool
- func IsValidIdentifier(s string) bool
- func ModuleDirective(name string, pos *ast.Position) *ast.Directive
- func QuerySideDirectives() []string
- func SetDirectiveArg(dir *ast.Directive, name, value string)
- func Sources() []*ast.Source
- func StripControlDirectives(dirs ast.DirectiveList) ast.DirectiveList
- type BatchRule
- type CompilationContext
- type CompiledCatalog
- type DefinitionRule
- type DefinitionsSource
- type DependentCompiledCatalog
- type DropDirectiveSpec
- type EngineCapabilities
- type EngineDeleteCapabilities
- type EngineGeneralCapabilities
- type EngineInsertCapabilities
- type EngineUpdateCapabilities
- type ExtensionsSource
- type HugrType
- type HugrTypeField
- type ModuleObjectType
- type ModuleRoot
- type MutableProvider
- type ObjectInfo
- type ObjectMutationType
- type ObjectQueryType
- type Options
- func (o *Options) ApplyPrefix(name string) string
- func (o *Options) IsArraysSupported() bool
- func (o *Options) IsCrossCatalogReferencesSupported() bool
- func (o *Options) IsSequenceDefaultSupported() bool
- func (o *Options) IsStructuredTypesSupported() bool
- func (o *Options) IsTablesSupported() bool
- func (o *Options) IsTypeSupported(typ string) bool
- func (o *Options) SupportDelete() bool
- func (o *Options) SupportDeleteWithoutPKs() bool
- func (o *Options) SupportInsert() bool
- func (o *Options) SupportInsertReferences() bool
- func (o *Options) SupportInsertReturning() bool
- func (o *Options) SupportUpdate() bool
- func (o *Options) SupportUpdatePKs() bool
- func (o *Options) SupportUpdateWithoutPKs() bool
- type Phase
- type Provider
- type QueryRequest
- type QueryType
- type Rule
Constants ¶
const ( CatalogDirectiveName = "catalog" DependencyDirectiveName = "dependency" ModuleCatalogDirectiveName = "module_catalog" )
const ( ObjectTableDirectiveName = "table" ObjectViewDirectiveName = "view" )
Object-level directive names.
const ( FieldPrimaryKeyDirectiveName = "pk" FieldGeometryInfoDirectiveName = "geometry_info" FieldSqlDirectiveName = "sql" FieldExtraFieldDirectiveName = "extra_field" FieldDefaultDirectiveName = "default" FieldDefaultDirectiveInsertExprArgName = "insert_exp" FieldDefaultDirectiveUpdateExprArgName = "update_exp" FieldMeasurementDirectiveName = "measurement" FieldMeasurementFuncArgName = "measurement_func" FieldDimDirectiveName = "dim" FieldExcludeMCPDirectiveName = "exclude_mcp" )
Field-level directive names.
const ( WithDeletedDirectiveName = "with_deleted" StatsDirectiveName = "stats" RawResultsDirectiveName = "raw" UnnestDirectiveName = "unnest" NoPushdownDirectiveName = "no_pushdown" )
Query-side directive names.
const ( QueryDirectiveName = "query" MutationDirectiveName = "mutation" FunctionDirectiveName = "function" FunctionCallDirectiveName = "function_call" FunctionCallTableJoinDirectiveName = "table_function_call_join" JoinDirectiveName = "join" ReferencesDirectiveName = "references" FieldReferencesDirectiveName = "field_references" ReferencesQueryDirectiveName = "references_query" FieldAggregationQueryDirectiveName = "aggregation_query" ModuleDirectiveName = "module" ModuleRootDirectiveName = "module_root" ViewArgsDirectiveName = "args" OriginalNameDirectiveName = "original_name" DeprecatedDirectiveName = "deprecated" FilterInputDirectiveName = "filter_input" FilterListInputDirectiveName = "filter_list_input" DataInputDirectiveName = "data_input" )
Query/mutation directive names.
const ( CacheDirectiveName = "cache" NoCacheDirectiveName = "no_cache" InvalidateCacheDirectiveName = "invalidate_cache" )
Cache directive names.
const ( AddH3DirectiveName = "add_h3" H3QueryFieldName = "h3" H3QueryTypeName = "_h3_query" H3DataQueryTypeName = "_h3_data_query" H3DataFieldName = "data" DistributionFieldName = "distribution_by" DistributionTypeName = "_distribution_by" BucketDistributionFieldName = "distribution_by_bucket" BucketDistributionTypeName = "_distribution_by_bucket" )
H3 directive and type names.
const ( GisFeatureDirectiveName = "feature" GisWFSDirectiveName = "wfs" GisWFSFieldDirectiveName = "wfs_field" GisWFSExcludeDirectiveName = "wfs_exclude" GisWFSTypeName = "_wfs_features" )
GIS/WFS directive and type names.
const ( QueryTimeJoinsFieldName = "_join" QueryTimeJoinsTypeName = "_join" QueryTimeSpatialFieldName = "_spatial" QueryTimeSpatialTypeName = "_spatial" )
Query-time join type/field names.
const ( VectorTypeName = "Vector" VectorSearchInputName = "VectorSearchInput" VectorDistanceTypeEnumName = "VectorDistanceType" VectorSearchDistanceL2 = "L2" VectorSearchDistanceIP = "Inner" VectorSearchDistanceCosine = "Cosine" SimilaritySearchArgumentName = "similarity" EmbeddingsDirectiveName = "embeddings" SemanticSearchArgumentName = "semantic" SemanticSearchInputName = "SemanticSearchInput" SummaryForEmbeddedArgumentName = "summary" DistanceFieldNameSuffix = "distance" VectorDistanceExtraFieldName = "VectorDistance" QueryEmbeddingDistanceExtraFieldName = "QueryEmbeddingDistance" QueryEmbeddingsDistanceFieldName = "_distance_to_query" )
Vector search directive and type names.
const ( FunctionTypeName = "Function" FunctionMutationTypeName = "MutationFunction" QueryBaseName = "Query" MutationBaseName = "Mutation" OperationResultTypeName = "OperationResult" )
Type name constants.
const ( JSONTypeName = "JSON" TimestampTypeName = "Timestamp" H3CellTypeName = "H3Cell" GeometryTypeName = "Geometry" GeometryAggregationTypeName = "GeometryAggregation" GeometryMeasurementExtraFieldName = "Measurement" TimestampExtractExtraFieldName = "Extract" )
Scalar type name constants.
const ( AggregateKeyFieldName = "key" AggregateFieldName = "aggregations" AggRowsCountFieldName = "_rows_count" AggregationSuffix = "_aggregation" BucketAggregationSuffix = "_bucket_aggregation" )
Aggregation constants.
const ( ListFilterInputSuffix = "_list_filter" FilterInputSuffix = "_filter" )
Input/filter constants.
const ( MutationTypeTextInsert = "INSERT" MutationTypeTextUpdate = "UPDATE" MutationTypeTextDelete = "DELETE" )
Mutation type text constants.
const ( JoinSourceFieldPrefix = "source" JoinRefFieldPrefix = "dest" )
Join field name prefixes.
const ( ObjectQueryByPKSuffix = "_by_pk" StubFieldName = "_stub" )
Object query constants.
const ( QueryTypeTextSelect = "SELECT" QueryTypeTextSelectOne = "SELECT_ONE" QueryTypeTextAggregate = "AGGREGATE" QueryTypeTextAggregateBucket = "AGGREGATE_BUCKET" )
Query type text constants (for @query directive "type" argument).
const ( ObjectHyperTableDirectiveName = "hypertable" ObjectCubeDirectiveName = "cube" ObjectUniqueDirectiveName = "unique" FieldReferencesQueryDirectiveName = "references_query" FieldTimescaleKeyDirectiveName = "timescale_key" InputFieldNamedArgDirectiveName = "named_arg" ObjectAggregationDirectiveName = "aggregation" ObjectFieldAggregationDirectiveName = "field_aggregation" )
Object-level secondary directive names.
const ( DescFilter = "Filter" DescOrderBy = "Sort options for the result set" DescLimit = "Limit the number of returned objects" DescOffset = "Skip the first n objects" DescDistinctOn = "Distinct on the given fields" DescInnerJoin = "Apply inner join to the result set" DescInnerJoinRef = "Apply inner join to reference record" DescArgs = "Arguments for the view" DescBucketKey = "The key of the bucket" DescNestedOrderBy = "Sort options for the nested result set" DescNestedLimit = "Limit the number of returned nested objects" DescNestedOffset = "Skip the first n nested objects" )
Query argument descriptions.
const ( ArgName = "name" ArgType = "type" ArgSQL = "sql" ArgExp = "exp" ArgField = "field" ArgRequired = "required" ArgDescription = "description" ArgReferencesName = "references_name" ArgSourceFields = "source_fields" ArgReferencesFields = "references_fields" ArgReferencesQuery = "references_query" ArgReferencesDescription = "references_description" ArgIsM2M = "is_m2m" ArgM2MName = "m2m_name" ArgIsTable = "is_table" ArgIsTableFuncJoin = "is_table_func_join" ArgIsBucket = "is_bucket" ArgBaseField = "base_field" ArgBaseType = "base_type" ArgQuery = "query" ArgSoftDelete = "soft_delete" ArgSoftDeleteCond = "soft_delete_cond" ArgSoftDeleteSet = "soft_delete_set" ArgSkipNullArg = "skip_null_arg" ArgJsonCast = "json_cast" ArgSequence = "sequence" ArgQuerySuffix = "query_suffix" ArgSkipQuery = "skip_query" ArgModule = "module" ArgModel = "model" ArgVector = "vector" ArgDistance = "distance" ArgLen = "len" ArgSRID = "srid" ArgArgs = "args" )
Directive argument name constants (shared between sdl and rules).
const ( // Drop type, input, enum value, or field from the schema DropDirectiveName = "drop" // Replace type, input, enum value, or field in the schema with the new definition ReplaceDirectiveName = "replace" // Skip adding the definition if it already exists IfNotExistsDirectiveName = "if_not_exists" // Drop a specific directive usage from the target definition or field DropDirectiveDirectiveName = "drop_directive" )
DDL directive names
const ( MetadataSchemaQuery = "__schema" MetadataTypeQuery = "__type" MetadataTypeNameQuery = "__typename" JQTransformQueryName = "jq" )
Metadata query constants.
const ( TableDataObject = "table" ViewDataObject = "view" )
const CatalogSystemVariableName = "$catalog"
Catalog system variable.
const FieldSourceDirectiveName = "field_source"
Variables ¶
var (
ErrDefinitionNotFound = errors.New("definition not found")
)
var SystemDirective = &ast.Directive{Name: "system", Position: CompiledPos("")}
SystemDirective is the sentinel directive marking compiler-generated definitions.
Functions ¶
func AddH3Directive ¶
func AddH3Directive(field string, resolution int, transformFrom int, buffer float64, divideVals bool, simplify bool, pos *ast.Position) *ast.Directive
AddH3Directive creates an @add_h3 directive with the given parameters.
func CloneArgumentDefinitionList ¶
func CloneArgumentDefinitionList(args ast.ArgumentDefinitionList) ast.ArgumentDefinitionList
func CloneArgumentList ¶
func CloneArgumentList(args ast.ArgumentList) ast.ArgumentList
func CloneDefinition ¶
func CloneDefinition(def *ast.Definition, fieldFilter func(*ast.FieldDefinition) bool) *ast.Definition
func CloneDirectiveList ¶
func CloneDirectiveList(dirs ast.DirectiveList) ast.DirectiveList
func CloneEnumValueList ¶
func CloneEnumValueList(enumValues ast.EnumValueList) ast.EnumValueList
func CloneFieldDefinition ¶
func CloneFieldDefinition(field *ast.FieldDefinition) *ast.FieldDefinition
func CompiledPos ¶
CompiledPos creates a position marker for compiled/generated AST elements.
func DefinitionCatalog ¶
func DefinitionCatalog(def *ast.Definition) string
func DefinitionDependencies ¶
func DefinitionDependencies(def *ast.Definition) []string
func DefinitionDirectiveArgString ¶
func DefinitionDirectiveArgString(def *ast.Definition, dirName, argName string) string
func DefinitionModuleCatalogs ¶
func DefinitionModuleCatalogs(def *ast.Definition) []string
DefinitionModuleCatalogs returns all catalog names from @module_catalog directives on a definition.
func DerivedExtensionFields ¶
DerivedExtensionFields returns field names that compilation adds to shared types (Query, Mutation, _join, _join_aggregation) for a given data object. Used by incremental compilation to emit @drop fields when a type is dropped or replaced. The fieldName parameter is the query/mutation field name (original name when AsModule, compiled name otherwise).
func DerivedTypeNames ¶
DerivedTypeNames returns the deterministic list of all type names generated from a source type during compilation. Used by incremental compilation to identify all types that must be dropped when a source type is dropped or replaced.
func DirectiveArgStrings ¶
DirectiveArgStrings extracts a list of string values from a directive argument.
func DropDirectiveIfExists ¶
func DropDirectiveIfExists(def *ast.Definition) bool
func DropFieldIfExists ¶
func DropFieldIfExists(field *ast.FieldDefinition) bool
func EnumValueCatalog ¶
func EnumValueCatalog(enumValue *ast.EnumValueDefinition) string
func FieldDefCatalog ¶
func FieldDefCatalog(field *ast.FieldDefinition) string
func FieldDefDependency ¶
func FieldDefDependency(field *ast.FieldDefinition) string
FieldDefDependency returns the dependency name from a field's @dependency directive.
func FieldDefDirectiveArgString ¶
func FieldDefDirectiveArgString(field *ast.FieldDefinition, dirName, argName string) string
func FieldDefModuleCatalogs ¶
func FieldDefModuleCatalogs(field *ast.FieldDefinition) []string
FieldDefModuleCatalogs returns all catalog names from @module_catalog directives on a field.
func FieldGeometryInfoDirective ¶
FieldGeometryInfoDirective creates a @geometry_info directive.
func FieldSourceDirective ¶
FieldSourceDirective creates a @field_source directive for renamed fields.
func FieldSqlDirective ¶
FieldSqlDirective creates a @sql directive with the given expression.
func Ident ¶
Ident quotes a SQL identifier if it is a reserved keyword or contains special characters.
func IsControlDirective ¶
IsControlDirective returns true for DDL control directives that should be stripped before inserting definitions into the schema.
func IsDropDefinition ¶
func IsDropDefinition(def *ast.Definition) bool
func IsDropEnumValue ¶
func IsDropEnumValue(ev *ast.EnumValueDefinition) bool
func IsDropField ¶
func IsDropField(field *ast.FieldDefinition) bool
func IsIfNotExistsDefinition ¶
func IsIfNotExistsDefinition(def *ast.Definition) bool
func IsReplaceDefinition ¶
func IsReplaceDefinition(def *ast.Definition) bool
func IsReplaceField ¶
func IsReplaceField(field *ast.FieldDefinition) bool
func IsValidIdentifier ¶
IsValidIdentifier returns true if the string is a valid unquoted SQL identifier.
func ModuleDirective ¶
ModuleDirective creates a @module directive with the given name.
func QuerySideDirectives ¶
func QuerySideDirectives() []string
QuerySideDirectives returns directive names that are valid on query fields.
func SetDirectiveArg ¶
SetDirectiveArg sets or adds a string argument on a directive.
func Sources ¶
Sources returns the base system type SDL sources. Scalar type SDL is provided separately by the types package.
func StripControlDirectives ¶
func StripControlDirectives(dirs ast.DirectiveList) ast.DirectiveList
StripControlDirectives returns a new directive list with all DDL control directives removed.
Types ¶
type BatchRule ¶
type BatchRule interface {
Rule
ProcessAll(ctx CompilationContext) error
}
BatchRule performs cross-cutting work after all DefinitionRules in the same phase.
type CompilationContext ¶
type CompilationContext interface {
Context() context.Context
Source() DefinitionsSource
CompileOptions() Options
ApplyPrefix(name string) string
// Scalar registry access
ScalarLookup(name string) types.ScalarType
IsScalar(name string) bool
// Output writing
AddDefinition(def *ast.Definition)
AddExtension(ext *ast.Definition)
AddDefinitionReplaceOrCreate(def *ast.Definition)
// PromoteToSource adds a definition to the source-level pool.
// Definitions added here are dispatched to DefinitionRules in subsequent phases,
// alongside source definitions. Used by PREPARE rules (e.g. InternalExtensionMerger)
// when an extension targets a provider type not present in the source.
PromoteToSource(def *ast.Definition)
// PromotedDefinitions returns definitions promoted via PromoteToSource.
// Used by PREPARE batch rules (e.g. PrefixPreparer) to also process promoted defs.
PromotedDefinitions() []*ast.Definition
// Type lookup: checks compilation output first, then target schema
LookupType(name string) *ast.Definition
LookupDirective(name string) *ast.DirectiveDefinition
// LookupExtension returns the accumulated extension for a given type name,
// or nil if no extensions have been added for that type.
LookupExtension(name string) *ast.Definition
// Shared state management
RegisterObject(name string, info *ObjectInfo)
GetObject(name string) *ObjectInfo
// Field collectors for ASSEMBLE phase
RegisterQueryFields(objectName string, fields []*ast.FieldDefinition)
RegisterMutationFields(objectName string, fields []*ast.FieldDefinition)
RegisterFunctionFields(fields []*ast.FieldDefinition)
RegisterFunctionMutationFields(fields []*ast.FieldDefinition)
// Field collector getters for ASSEMBLE phase
QueryFields() map[string][]*ast.FieldDefinition
MutationFields() map[string][]*ast.FieldDefinition
FunctionFields() []*ast.FieldDefinition
FunctionMutationFields() []*ast.FieldDefinition
// Object iteration
Objects() iter.Seq2[string, *ObjectInfo]
// Output iteration (for FINALIZE rules)
OutputDefinitions() iter.Seq[*ast.Definition]
OutputExtensions() iter.Seq[*ast.Definition]
// Dependency registration (extension compilation)
RegisterDependency(name string)
}
CompilationContext provides rules access to source, target schema lookups, output writing, scalar registry, and shared state.
type CompiledCatalog ¶
type CompiledCatalog interface {
DefinitionsSource
ExtensionsSource
}
CompiledCatalog is the DDL feed output of compilation, consumable by static.Provider.Update().
type DefinitionRule ¶
type DefinitionRule interface {
Rule
Match(def *ast.Definition) bool
Process(ctx CompilationContext, def *ast.Definition) error
}
DefinitionRule processes individual source definitions matching a predicate.
type DefinitionsSource ¶
type DefinitionsSource interface {
ForName(ctx context.Context, name string) *ast.Definition
DirectiveForName(ctx context.Context, name string) *ast.DirectiveDefinition
// iteration
Definitions(ctx context.Context) iter.Seq[*ast.Definition]
DirectiveDefinitions(ctx context.Context) iter.Seq2[string, *ast.DirectiveDefinition]
}
DefinitionsSource resolves types and directives with context support. A subset of Provider for functions that only need type resolution.
type DependentCompiledCatalog ¶
type DependentCompiledCatalog interface {
Dependencies() []string
}
DependentCompiledCatalog extends CompiledCatalog with dependency information collected from @dependency directives during extension compilation.
type DropDirectiveSpec ¶
type DropDirectiveSpec struct {
Name string // directive name to drop
Match map[string]string // argument values to match (nil = drop all instances)
}
DropDirectiveSpec describes which directive to remove from a target.
func DropDirectiveSpecs ¶
func DropDirectiveSpecs(def *ast.Definition) []DropDirectiveSpec
DropDirectiveSpecs extracts all @drop_directive specs from a definition's directives.
func FieldDropDirectiveSpecs ¶
func FieldDropDirectiveSpecs(field *ast.FieldDefinition) []DropDirectiveSpec
FieldDropDirectiveSpecs extracts all @drop_directive specs from a field's directives.
type EngineCapabilities ¶
type EngineCapabilities struct {
General EngineGeneralCapabilities
Insert EngineInsertCapabilities
Update EngineUpdateCapabilities
Delete EngineDeleteCapabilities
}
EngineCapabilities declares what an engine supports.
type ExtensionsSource ¶
type ExtensionsSource interface {
DefinitionsSource
// Extensions
DefinitionExtensions(ctx context.Context, name string) iter.Seq[*ast.Definition]
Extensions(ctx context.Context) iter.Seq[*ast.Definition]
}
ExtensionsSource extends DefinitionsSource with support for definition extensions.
type HugrType ¶
type HugrType string
HugrType identifies the kind of a compiled schema definition for introspection.
const ( HugrTypeModule HugrType = "module" HugrTypeTable HugrType = "table" HugrTypeView HugrType = "view" HugrTypeJoin HugrType = "join_queries" HugrTypeSpatial HugrType = "spatial_queries" HugrTypeH3Data HugrType = "h3_data" HugrTypeH3Agg HugrType = "h3_aggregate" HugrTypeFilter HugrType = "filter" HugrTypeFilterList HugrType = "filter_list" HugrTypeDataInput HugrType = "data_input" )
type HugrTypeField ¶
type HugrTypeField string
HugrTypeField identifies the kind of a field within a compiled definition.
const ( HugrTypeFieldSubmodule HugrTypeField = "submodule" HugrTypeFieldSelectOne HugrTypeField = "select_one" HugrTypeFieldSelect HugrTypeField = "select" HugrTypeFieldAgg HugrTypeField = "aggregate" HugrTypeFieldBucketAgg HugrTypeField = "bucket_agg" HugrTypeFieldFunction HugrTypeField = "function" HugrTypeFieldJoin HugrTypeField = "join" HugrTypeFieldSpatial HugrTypeField = "spatial" HugrTypeFieldH3Agg HugrTypeField = "h3_aggregate" HugrTypeFieldJQ HugrTypeField = "jq" HugrTypeFieldMutationInsert HugrTypeField = "mutation_insert" HugrTypeFieldMutationUpdate HugrTypeField = "mutation_update" HugrTypeFieldMutationDelete HugrTypeField = "mutation_delete" HugrTypeFieldExtraField HugrTypeField = "extra_field" )
type ModuleObjectType ¶
type ModuleObjectType int
ModuleObjectType identifies the kind of module root object.
const ( ModuleQuery ModuleObjectType = iota + 1 ModuleMutation ModuleFunction ModuleMutationFunction )
type ModuleRoot ¶
type ModuleRoot struct {
Name string
Type ModuleObjectType
}
ModuleRoot holds extracted module information from a type definition.
func ModuleRootInfo ¶
func ModuleRootInfo(def *ast.Definition) *ModuleRoot
ModuleRootInfo extracts module root information from @module_root directive or by well-known type name (Query, Mutation, Function, MutationFunction).
type MutableProvider ¶
type MutableProvider interface {
Provider
// SetDefinitionDescription updates a type's description and long description.
SetDefinitionDescription(ctx context.Context, name, desc, longDesc string) error
// SetFieldDescription updates a field's description and long description.
SetFieldDescription(ctx context.Context, typeName, fieldName, desc, longDesc string) error
// SetModuleDescription updates a module's description and long description.
SetModuleDescription(ctx context.Context, name, desc, longDesc string) error
// SetCatalogDescription updates a catalog's description and long description.
SetCatalogDescription(ctx context.Context, name, desc, longDesc string) error
DropCatalog(ctx context.Context, name string, cascade bool) error
Update(ctx context.Context, changes DefinitionsSource) error
}
MutableProvider is a mutable container for schema definitions.
type ObjectInfo ¶
type ObjectInfo struct {
Name string
OriginalName string
TableName string
Module string
IsReplace bool
IsView bool
IsM2M bool
IsCube bool
IsHypertable bool
PrimaryKey []string
// Parameterized views (@args)
InputArgsName string // input type name from @args(name: "...")
RequiredArgs bool // true if any field in input type is NonNull or @args(required: true)
}
ObjectInfo caches shared metadata about a data object during compilation.
func RecoverObjectInfo ¶
func RecoverObjectInfo(def *ast.Definition) *ObjectInfo
RecoverObjectInfo reconstructs ObjectInfo from an already-compiled provider definition by reading its directives. Used during incremental compilation to recover metadata about existing types in the provider schema.
type ObjectMutationType ¶
type ObjectMutationType int
ObjectMutationType represents the kind of mutation generated for a data object.
const ( MutationTypeInsert ObjectMutationType = iota MutationTypeUpdate MutationTypeDelete )
func (ObjectMutationType) String ¶
func (m ObjectMutationType) String() string
type ObjectQueryType ¶
type ObjectQueryType int
ObjectQueryType represents the kind of query generated for a data object.
const ( QueryTypeSelect ObjectQueryType = iota QueryTypeSelectOne QueryTypeAggregate QueryTypeAggregateBucket SubQueryTypeReferencesData SubQueryTypeJoinData SubQueryTypeFunctionCallData SubQueryTypeFunctionCallTableJoinData )
type Options ¶
type Options struct {
Name string
ReadOnly bool
Prefix string
EngineType string
AsModule bool
IsExtension bool
Capabilities *EngineCapabilities
}
Options configures compilation behavior.
func (*Options) ApplyPrefix ¶
ApplyPrefix prepends the prefix to a name with underscore separator if set.
func (*Options) IsArraysSupported ¶
func (*Options) IsCrossCatalogReferencesSupported ¶
func (*Options) IsSequenceDefaultSupported ¶
func (*Options) IsStructuredTypesSupported ¶
func (*Options) IsTablesSupported ¶
func (*Options) IsTypeSupported ¶
func (*Options) SupportDelete ¶
func (*Options) SupportDeleteWithoutPKs ¶
func (*Options) SupportInsert ¶
func (*Options) SupportInsertReferences ¶
func (*Options) SupportInsertReturning ¶
func (*Options) SupportUpdate ¶
func (*Options) SupportUpdatePKs ¶
func (*Options) SupportUpdateWithoutPKs ¶
type Provider ¶
type Provider interface {
DefinitionsSource
Description(ctx context.Context) string
// Root operation types
QueryType(ctx context.Context) *ast.Definition
MutationType(ctx context.Context) *ast.Definition
SubscriptionType(ctx context.Context) *ast.Definition
// Type relationships (for validator: fragment spreading, interface checks)
PossibleTypes(ctx context.Context, name string) iter.Seq[*ast.Definition]
Implements(ctx context.Context, name string) iter.Seq[*ast.Definition]
// types iteration (for introspection, meta-info)
Types(ctx context.Context) iter.Seq2[string, *ast.Definition]
}
Provider is a read-only interface to a compiled schema. All methods accept context.Context for future storage-backed implementations.
type QueryRequest ¶
type QueryRequest struct {
Name string
OrderNum int
QueryType QueryType
Field *ast.Field
Subset []QueryRequest
}
QueryRequest is a classified entry from an operation's selection set.