Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AmbiguityError ¶
AmbiguityError reports multiple matching type candidates for a type expression.
func (*AmbiguityError) Error ¶
func (e *AmbiguityError) Error() string
type Context ¶
type Context struct {
DefaultPackage string `json:",omitempty" yaml:",omitempty"`
Imports []Import `json:",omitempty" yaml:",omitempty"`
PackageDir string `json:",omitempty" yaml:",omitempty"`
PackageName string `json:",omitempty" yaml:",omitempty"`
PackagePath string `json:",omitempty" yaml:",omitempty"`
}
Context captures default package and imports used for type resolution.
type Import ¶
type Import struct {
Alias string `json:",omitempty" yaml:",omitempty"`
Package string `json:",omitempty" yaml:",omitempty"`
}
Import describes one package alias import for DQL/type resolution.
type Provenance ¶
type Provenance struct {
Package string `json:",omitempty" yaml:",omitempty"`
File string `json:",omitempty" yaml:",omitempty"`
Kind string `json:",omitempty" yaml:",omitempty"` // builtin, resource_type, registry, ast_type
}
Provenance tracks where a resolved type came from.
type Resolution ¶
type Resolution struct {
Expression string `json:",omitempty" yaml:",omitempty"`
Target string `json:",omitempty" yaml:",omitempty"`
ResolvedKey string `json:",omitempty" yaml:",omitempty"`
MatchKind string `json:",omitempty" yaml:",omitempty"` // exact, alias_import, qualified, default_package, import_package, global_unique
Provenance Provenance `json:",omitempty" yaml:",omitempty"`
}
Resolution captures one resolved type expression and its provenance.
type Resolver ¶
type Resolver struct {
// contains filtered or unexported fields
}
Resolver resolves cast/tag type expressions against viant/x registry using type context.
func NewResolver ¶
NewResolver creates a type resolver.
func NewResolverWithProvenance ¶
func NewResolverWithProvenance(registry *x.Registry, context *Context, provenance map[string]Provenance) *Resolver
NewResolverWithProvenance creates a type resolver with optional registry-key provenance map.
func (*Resolver) Resolve ¶
Resolve resolves type expression to registry key. It returns ("", nil) when unresolved.
func (*Resolver) ResolveWithProvenance ¶
func (r *Resolver) ResolveWithProvenance(typeExpr string) (*Resolution, error)
ResolveWithProvenance resolves expression and returns provenance details. It returns (nil, nil) when unresolved.
type ValidationIssue ¶
ValidationIssue captures context consistency problems.