Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Listener ¶
type Listener func(t *Type)
Listener is invoked on registration events.
When used with Register (single-type), the registry's configured Listener is called with the registered type. When used during Merge (multi-type), the effective listener is the one returned by the MergeListener factory (if configured) and is called once per merged type. See MergeListener for end-of-merge signalling.
type MergeListener ¶ added in v0.3.0
type MergeListener func() Listener
MergeListener is a factory for a per-merge Listener.
Merge obtains a fresh Listener by calling the MergeListener at the start of the merge, then invokes the returned Listener for each merged type. After all types have been processed, the returned Listener is called once with a nil *Type to signal end-of-merge. Implementations MUST tolerate a nil argument and treat it as a completion notification.
type Option ¶
type Option func(t *Type)
Option represent type option
func WithPkgPath ¶ added in v0.3.0
WithPkgPath is an option to set the package path of the type
func WithSynteticType ¶ added in v0.4.0
WithSynteticType sets a prebuilt synthetic/model.Type on this runtime Type. This allows callers to attach a codegen-ready representation directly.
func WithSyntheticType ¶ added in v0.4.0
WithSyntheticType is an alias for WithSynteticType with conventional spelling. Kept to improve ergonomics while the package name remains "syntetic".
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry represents an extension type
func NewRegistry ¶
func NewRegistry(options ...RegistryOption) *Registry
NewRegistry creates a registry
func (*Registry) ForEach ¶ added in v0.4.0
ForEach invokes fn for each registered type using a sorted snapshot of Keys. Iteration stops early when fn returns false. Callbacks are invoked without holding internal locks.
func (*Registry) Keys ¶ added in v0.4.0
Keys returns a sorted snapshot of registry keys.
The returned slice is detached from the underlying map so callers are free to modify it. Ordering is deterministic for a given registry state but concurrent mutation while iterating is not supported.
func (*Registry) Merge ¶
Merge merges all types from the supplied registry into r.
Listener behaviour:
- If a MergeListener is configured, Merge calls it once to obtain a per-merge Listener and uses that for all per-type notifications. After processing all types, the per-merge Listener is called once with a nil *Type to signal completion. Implementations MUST tolerate nil.
- If no MergeListener is configured, Merge uses the registry's general Listener (if any) for per-type notifications and does not emit a final nil sentinel call.
type RegistryOption ¶
type RegistryOption func(r *Registry)
RegistryOption represent registry option
func WithListener ¶
func WithListener(listener Listener) RegistryOption
WithListener creates a new registry with the specified listener
func WithMergeListener ¶ added in v0.3.0
func WithMergeListener(listener MergeListener) RegistryOption
WithMergeListener creates a new registry with the specified listener
Semantics:
- The provided factory is invoked at the start of Registry.Merge to obtain a per-merge Listener.
- The returned Listener is called once for each merged type.
- After all types are processed, the returned Listener is called once with a nil *Type to signal completion. Implementations MUST handle nil.
- If no MergeListener is configured, Merge falls back to the registry's general Listener (configured via WithListener) without the nil sentinel.
func WithRegistryScn ¶
func WithRegistryScn(scn int) RegistryOption
WithRegistryScn is an option to set scn time
type Type ¶
type Type struct {
Type reflect.Type
PkgPath string
// Location is kept for backward compatibility with earlier x.Type shape.
Location string
Name string
Definition string
Scn int
Force bool
// SynteticType optionally carries a prebuilt synthetic/model Type
// associated with this runtime type. This allows callers to attach
// a codegen-ready representation without re-deriving it via bridges.
SynteticType *model.Type
// contains filtered or unexported fields
}
Type represents a type
Directories
¶
| Path | Synopsis |
|---|---|
|
builder
|
|
|
ast
Package ast provides a thin façade over the syntetic/model AST helpers so you can use a consistent "builder" entrypoint for generating declarations and rendered files.
|
Package ast provides a thin façade over the syntetic/model AST helpers so you can use a consistent "builder" entrypoint for generating declarations and rendered files. |
|
xreflect
Package xreflect provides a stateful builder that materializes runtime reflect.Type values from the syntetic/model Node graph.
|
Package xreflect provides a stateful builder that materializes runtime reflect.Type values from the syntetic/model Node graph. |
|
examples
|
|
|
namespace_files
command
|
|
|
registry_render
command
|
|
|
extension
module
|
|
|
loader
|
|
|
ast
Package loader: convert.go contains helpers that convert parsed Go AST expressions and function types into the model's intermediate Node and Func representations, including generic type parameters and alias resolution using import alias maps.
|
Package loader: convert.go contains helpers that convert parsed Go AST expressions and function types into the model's intermediate Node and Func representations, including generic type parameters and alias resolution using import alias maps. |
|
xreflect
Package xreflect provides a reflect-based loader that builds a model.Package or model.Module from reflect.Type values.
|
Package xreflect provides a reflect-based loader that builds a model.Package or model.Module from reflect.Type values. |
|
adapter
Package adapter provides small adapters between external storage services (e.g., viant/afs) and Go's standard io/fs interfaces so that loaders can operate against arbitrary backends.
|
Package adapter provides small adapters between external storage services (e.g., viant/afs) and Go's standard io/fs interfaces so that loaders can operate against arbitrary backends. |
|
model
Package model defines an intermediate, reflect-agnostic representation of Go types used by the loader and code generation pipeline.
|
Package model defines an intermediate, reflect-agnostic representation of Go types used by the loader and code generation pipeline. |
|
model/transform
Package transform provides a small, composable layer to apply structural rewrites to syntetic/model graphs without polluting the core model or the builders.
|
Package transform provides a small, composable layer to apply structural rewrites to syntetic/model graphs without polluting the core model or the builders. |
|
transient
module
|