compile

package
v0.38.0 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2026 License: Apache-2.0 Imports: 40 Imported by: 0

Documentation

Overview

Package compile provides DQL-to-shape compilation.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CompileError

type CompileError struct {
	Diagnostics []*dqlshape.Diagnostic
}

CompileError represents one or more compilation diagnostics.

func (*CompileError) Error

func (e *CompileError) Error() string

type ComponentContract added in v0.38.0

type ComponentContract struct {
	RouteKey   string
	Method     string
	URI        string
	OutputType string
	Types      []*plan.Type
}

ComponentContract represents resolved component contract metadata.

type ComponentResolver added in v0.38.0

type ComponentResolver interface {
	ResolveContract(ctx context.Context, routeKey string) (*ComponentContract, error)
}

ComponentResolver resolves component contract metadata for a route key.

type DQLCompiler

type DQLCompiler struct{}

DQLCompiler compiles raw DQL into a shape plan that can be materialized by shape/load.

func New

func New() *DQLCompiler

New returns a DQL compiler implementation.

func (*DQLCompiler) Compile

func (c *DQLCompiler) Compile(ctx context.Context, source *shape.Source, opts ...shape.CompileOption) (*shape.PlanResult, error)

Compile implements shape.DQLCompiler.

type RouteIndex added in v0.38.0

type RouteIndex struct {
	ByRouteKey  map[string]*RouteIndexEntry
	ByNamespace map[string][]*RouteIndexEntry
	Conflicts   map[string][]string
}

RouteIndex stores source-to-route mapping and lookup structures.

func BuildRouteIndex added in v0.38.0

func BuildRouteIndex(paths []string, opts ...shape.CompileOption) (*RouteIndex, error)

BuildRouteIndex scans DQL files and builds route-key mapping.

func (*RouteIndex) Resolve added in v0.38.0

func (r *RouteIndex) Resolve(ref, currentSource string, opts ...shape.CompileOption) (string, bool)

Resolve maps a component reference from current source context to route key. It returns false when route cannot be resolved deterministically.

type RouteIndexEntry added in v0.38.0

type RouteIndexEntry struct {
	RouteKey   string
	Method     string
	URI        string
	SourcePath string
	Namespace  string
}

RouteIndexEntry maps one source DQL file to one concrete method+URI route key.

type SignatureResolver added in v0.38.0

type SignatureResolver struct {
	// contains filtered or unexported fields
}

SignatureResolver adapts repository/contract/signature service to compile-time component contract resolution.

func NewSignatureResolver added in v0.38.0

func NewSignatureResolver(ctx context.Context, apiPrefix, routesURL string) (*SignatureResolver, error)

NewSignatureResolver creates signature-backed component resolver.

func (*SignatureResolver) ResolveContract added in v0.38.0

func (s *SignatureResolver) ResolveContract(_ context.Context, routeKey string) (*ComponentContract, error)

ResolveContract resolves component contract by route key.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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