typectx

package
v0.39.2 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2026 License: Apache-2.0 Imports: 5 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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