Documentation ¶
Index ¶
- type CompilationStorage
- type CompileContext
- func (c *CompileContext) CurrentPackage() string
- func (c *CompileContext) GenerateObjName(name, suffix string) string
- func (c *CompileContext) PathStack() []string
- func (c *CompileContext) PathStackRef(joinParts ...string) string
- func (c *CompileContext) PutListPromise(p ObjectListPromise)
- func (c *CompileContext) PutObject(obj Renderer)
- func (c *CompileContext) PutPromise(p ObjectPromise)
- func (c *CompileContext) RegisterNameTop(n string)
- func (c *CompileContext) RuntimeModule(subPackage string) string
- func (c *CompileContext) WithResultsStore(store CompilationStorage) *CompileContext
- type CompileOpts
- type CompilerLogger
- func (c *CompilerLogger) Debug(msg string, args ...any)
- func (c *CompilerLogger) Fatal(msg string, err error)
- func (c *CompilerLogger) Info(msg string, args ...any)
- func (c *CompilerLogger) NextCallLevel()
- func (c *CompilerLogger) PrevCallLevel()
- func (c *CompilerLogger) Trace(msg string, args ...any)
- func (c *CompilerLogger) Warn(msg string, args ...any)
- type ContextStackItem
- type FileScope
- type GolangType
- type ObjectCompileOpts
- type ObjectListPromise
- type ObjectPromise
- type PackageScope
- type PromiseOrigin
- type ProtocolRenderer
- type RenderContext
- type RenderOpts
- type Renderer
- type SchemaTag
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CompilationStorage ¶
type CompilationStorage interface { AddObject(pkgName string, stack []string, obj Renderer) RegisterProtocol(protoName string) AddExternalSpecPath(specPath *specurl.URL) AddPromise(p ObjectPromise) AddListPromise(p ObjectListPromise) SetDefaultContentType(contentType string) DefaultContentType() string SetActiveServers(servers []string) ActiveServers() []string SetActiveChannels(channels []string) ActiveChannels() []string }
type CompileContext ¶
type CompileContext struct { Storage CompilationStorage Stack types.SimpleStack[ContextStackItem] Logger *CompilerLogger CompileOpts CompileOpts // contains filtered or unexported fields }
func NewCompileContext ¶
func NewCompileContext(specPath *specurl.URL, compileOpts CompileOpts) *CompileContext
func (*CompileContext) CurrentPackage ¶
func (c *CompileContext) CurrentPackage() string
func (*CompileContext) GenerateObjName ¶
func (c *CompileContext) GenerateObjName(name, suffix string) string
func (*CompileContext) PathStack ¶
func (c *CompileContext) PathStack() []string
func (*CompileContext) PathStackRef ¶
func (c *CompileContext) PathStackRef(joinParts ...string) string
PathStackRef returns a path to the current stack as a reference. NOTE: the reference is URL-encoded.
func (*CompileContext) PutListPromise ¶
func (c *CompileContext) PutListPromise(p ObjectListPromise)
func (*CompileContext) PutObject ¶
func (c *CompileContext) PutObject(obj Renderer)
func (*CompileContext) PutPromise ¶
func (c *CompileContext) PutPromise(p ObjectPromise)
func (*CompileContext) RegisterNameTop ¶
func (c *CompileContext) RegisterNameTop(n string)
func (*CompileContext) RuntimeModule ¶
func (c *CompileContext) RuntimeModule(subPackage string) string
func (*CompileContext) WithResultsStore ¶
func (c *CompileContext) WithResultsStore(store CompilationStorage) *CompileContext
type CompileOpts ¶
type CompileOpts struct { ChannelOpts ObjectCompileOpts MessageOpts ObjectCompileOpts ModelOpts ObjectCompileOpts ServerOpts ObjectCompileOpts ReusePackages map[string]string NoEncodingPackage bool AllowRemoteRefs bool RuntimeModule string GeneratePublishers bool GenerateSubscribers bool }
type CompilerLogger ¶
type CompilerLogger struct {
// contains filtered or unexported fields
}
func (*CompilerLogger) Debug ¶
func (c *CompilerLogger) Debug(msg string, args ...any)
func (*CompilerLogger) Fatal ¶
func (c *CompilerLogger) Fatal(msg string, err error)
func (*CompilerLogger) Info ¶
func (c *CompilerLogger) Info(msg string, args ...any)
func (*CompilerLogger) NextCallLevel ¶
func (c *CompilerLogger) NextCallLevel()
func (*CompilerLogger) PrevCallLevel ¶
func (c *CompilerLogger) PrevCallLevel()
func (*CompilerLogger) Trace ¶
func (c *CompilerLogger) Trace(msg string, args ...any)
func (*CompilerLogger) Warn ¶
func (c *CompilerLogger) Warn(msg string, args ...any)
type ContextStackItem ¶
type GolangType ¶
type ObjectCompileOpts ¶
type ObjectCompileOpts struct { Enable bool IncludeRegex *regexp.Regexp ExcludeRegex *regexp.Regexp }
func (ObjectCompileOpts) IsAllowedName ¶
func (o ObjectCompileOpts) IsAllowedName(name string) bool
type ObjectListPromise ¶
type ObjectPromise ¶
type PackageScope ¶
type PackageScope int
const ( PackageScopeType PackageScope = iota PackageScopeAll )
type PromiseOrigin ¶
type PromiseOrigin int
const ( PromiseOriginUser PromiseOrigin = iota PromiseOriginInternal )
type ProtocolRenderer ¶
type RenderContext ¶
type RenderContext struct { ProtoRenderers map[string]ProtocolRenderer CurrentPackage string Logger *types.Logger RenderOpts RenderOpts // contains filtered or unexported fields }
func (*RenderContext) GeneratedModule ¶
func (c *RenderContext) GeneratedModule(subPackage string) string
func (*RenderContext) LogFinishRender ¶
func (c *RenderContext) LogFinishRender()
func (*RenderContext) LogStartRender ¶
func (c *RenderContext) LogStartRender(kind, pkg, name, mode string, directRendering bool, args ...any)
LogStartRender is typically called at the beginning of a RenderDefinition or RenderUsage method and logs that the object is started to be rendered. It also logs the object's name, type, and the current package. Every call to LogStartRender should be followed by a call to LogFinishRender which logs that the object is finished to be rendered.
func (*RenderContext) RuntimeModule ¶
func (c *RenderContext) RuntimeModule(subPackage string) string
type RenderOpts ¶
type Renderer ¶
type Renderer interface { DirectRendering() bool RenderDefinition(ctx *RenderContext) []*jen.Statement RenderUsage(ctx *RenderContext) []*jen.Statement ID() string // Human-readable object identifier (typically it's the name), for logging, go file name, etc. String() string }
type SchemaTag ¶
type SchemaTag string
const ( // SchemaTagDirectRender marks that an object must have directRender=true SchemaTagDirectRender SchemaTag = "directRender" // SchemaTagPkgScope sets the package scope for an object. Inherited by nested objects SchemaTagPkgScope SchemaTag = "pkgScope" // SchemaTagComponent marks all top-level objects in `component` section SchemaTagComponent SchemaTag = "components" // SchemaTagMarshal marks that an object is meant to be marshaled/unmarshaled. Inherited by nested objects SchemaTagMarshal SchemaTag = "marshal" )
Click to show internal directories.
Click to hide internal directories.