Documentation
¶
Overview ¶
Package tag owns Datly-specific Go struct-tag metadata.
Binding tags are delegated to Bindly and sqlx tags are delegated to SQLX; this package does not maintain compatibility parsers for either mechanism.
Index ¶
- Constants
- func BindingAliases(field reflect.StructField, param *spec.Parameter) []string
- func ParseInvariant(value string) (string, error)
- func ParsePredicates(structTag reflect.StructTag) ([]*spec.Predicate, error)
- func ParseSQLMethods(value string) ([]spec.SQLMethod, error)
- func PredicateValue(predicate *spec.Predicate) (string, error)
- func RelationValue(links []*RelationLink) (string, error)
- type BindingField
- type BindingIndex
- type Codec
- type Component
- type Field
- type QuerySelector
- type RelationLink
- type RelationPart
- type SQL
- type SelfReference
- type Settings
- type View
Constants ¶
const ( RouteNameTag = "routeName" APIKeyHeaderTag = "apiKeyHeader" APIKeyValueTag = "apiKeyValue" InternalTag = "internal" MCPTag = "mcp" )
const ( SQLName = "sql" RelationName = "on" SourceName = "source" SelectorAlias = "selectorAlias" GroupableName = "groupable" DescriptionName = "desc" ExampleName = "example" )
const ( SequenceStrategyTag = "sequenceStrategy" CaseFormatTag = "caseFormat" CacheTag = "cache" JSONMarshalTag = "jsonMarshal" JSONUnmarshalTag = "jsonUnmarshal" XMLUnmarshalTag = "xmlUnmarshal" FormatTag = "format" DateFormatTag = "dateFormat" OutputSettingsTag = "output" IgnoreEmptyQueryTag = "ignoreEmptyQueryParameters" MutationTag = "mutation" )
const CodecName = "codec"
const ComponentName = "component"
const InvariantName = "invariant"
const PredicateName = "predicate"
const QuerySelectorName = "querySelector"
const SelfName = "self"
const ViewName = "view"
Variables ¶
This section is empty.
Functions ¶
func BindingAliases ¶
func BindingAliases(field reflect.StructField, param *spec.Parameter) []string
BindingAliases returns the logical and physical names for one bound field. A param source names another input datapoint and is therefore a dependency, not an alias owned by the derived destination field.
func ParseInvariant ¶
ParseInvariant accepts one authored group name. Group-to-method naming is a semantic compilation decision; this boundary does not split lists silently.
func ParsePredicates ¶
ParsePredicates parses every predicate tag attached to one Go field.
func ParseSQLMethods ¶
ParseSQLMethods decodes the canonical selector-method JSON used by both Go view tags and DQL selector policy declarations.
func PredicateValue ¶
PredicateValue formats canonical predicate metadata using ParsePredicates' grammar. Argument order remains authored order.
func RelationValue ¶
func RelationValue(links []*RelationLink) (string, error)
RelationValue formats typed relation links using ParseRelation's grammar.
Types ¶
type BindingField ¶
type BindingField struct {
Field reflect.StructField
Binding bindly.BindingSpec
Tagged bool
}
type BindingIndex ¶
type BindingIndex struct {
// contains filtered or unexported fields
}
BindingIndex is the parsed Bindly field metadata for one input contract.
func NewBindingIndex ¶
func NewBindingIndex(structType reflect.Type) (*BindingIndex, error)
func (*BindingIndex) Fields ¶
func (i *BindingIndex) Fields() []BindingField
func (*BindingIndex) Resolve ¶
func (i *BindingIndex) Resolve(param *spec.Parameter) (reflect.StructField, bool, error)
Resolve matches a canonical parameter to a Go input field. Structural names take precedence for ordinary parameters. View selectors first match their explicit source because different views can share a logical property name. Bindly aliases and source locations handle remaining package field matches.
type Codec ¶
func ParseCodec ¶
type Component ¶
type Component struct {
Documentation xdocs.Source
Name string
RouteName string
Path string
Method string
Connector string
Marshaller string
Handler string
APIKeyHeader string
APIKeyValue string
Input string
Output string
View string
Source string
Description string
Example string
Internal bool
WarmupTarget string
Report bool
ReportCompose *spec.CubeComposeSettings
ReportMCPTool *bool
ReportLinkedInputType string
ReportDimensions string
ReportMeasures string
ReportFilters string
ReportOrderBy string
ReportLimit string
ReportOffset string
MCP []*spec.MCPExposure
Settings Settings
}
Component is the metadata carried by a component holder field.
func ParseComponentValue ¶
func (Component) ValidateRoute ¶
type Field ¶
type Field struct {
Component *Component
View *View
Self *SelfReference
Codec *Codec
SQL *SQL
Binding *bindly.BindingSpec
Relation []*RelationLink
Predicates []*spec.Predicate
QuerySelector *QuerySelector
FormatSelector bool
Source string
SelectorAlias string
Description string
Example string
Groupable bool
MCP *bool
PathMCP *bool
Invariant string
}
Field is the parsed Datly metadata for one Go field. Generic binding and SQLX metadata remain represented by their owning packages.
func ParseField ¶
func ParseField(field reflect.StructField) (*Field, error)
type QuerySelector ¶
type QuerySelector struct {
View string
Property spec.SelectorProperty
}
QuerySelector identifies the view property bound to one selector input field.
func ParseQuerySelector ¶
func ParseQuerySelector(value string) (*QuerySelector, error)
ParseQuerySelector accepts querySelector:"users" and querySelector:"view=users".
func (QuerySelector) Value ¶
func (q QuerySelector) Value() (string, error)
Value formats query-selector metadata using ParseQuerySelector's grammar.
type RelationLink ¶
type RelationLink struct {
Parent RelationPart
Child RelationPart
}
RelationLink is one typed parent-to-child equality from an on tag.
func ParseRelation ¶
func ParseRelation(value string) ([]*RelationLink, error)
ParseRelation parses the complete comma-separated on-tag relation contract.
type RelationPart ¶
RelationPart identifies an optional Go field, SQL namespace, and required SQL column.
type SelfReference ¶
func ParseSelf ¶
func ParseSelf(value string) (*SelfReference, error)
func (SelfReference) Value ¶
func (s SelfReference) Value() (string, error)
Value formats self-reference metadata using ParseSelf's grammar.
type Settings ¶
type Settings struct {
Mutation string
SequenceStrategy string
MCPFolders []spec.ResourceFolder
IgnoreEmptyQueryParameters *bool
CaseFormat string
Cache *spec.CacheSettings
JSONMarshalType string
JSONUnmarshalType string
XMLUnmarshalType string
Format string
DateFormat string
Output *spec.OutputSettings
}
Settings contains component settings that remain meaningful after package generation. spec.Settings.Generation, type names, documentation sources, and constants are deliberately excluded because transcription consumes or materializes them before package bootstrap.
func SettingsFromSpec ¶
type View ¶
type View struct {
Name string
TypeName string
Dest string
EntityHooks string
URI string
Connector string
Table string
Cache string
CacheWarmup string
OrderBy string
Limit *int
Offset *int
Batch int
BatchConcurrency int
Match string
PublishParent bool
RelationalConcurrency int
AllowNulls *bool
Groupable *bool
Auxiliary bool
Partitioning *spec.Partitioning
Selector *spec.Selector
}