typectx

package
v0.37.0 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AmbiguityError

type AmbiguityError struct {
	Expression string
	Candidates []string
}

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.

func Normalize

func Normalize(input *Context) *Context

Normalize trims and canonicalizes context fields.

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

func NewResolver(registry *x.Registry, context *Context) *Resolver

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

func (r *Resolver) Resolve(typeExpr string) (string, error)

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

type ValidationIssue struct {
	Field   string
	Message string
}

ValidationIssue captures context consistency problems.

func Validate

func Validate(ctx *Context) []ValidationIssue

Validate checks context consistency.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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