Documentation
¶
Overview ¶
Package semver provides a CEL-runtime plugin that exposes a `semver` object with helpers for parsing and comparing Semantic Versioning 2.0.0 strings. See docs/03-ampel-policy-guide.md for the list of exposed methods and usage examples.
Index ¶
- Variables
- type Plugin
- type SemverTool
- func (st *SemverTool) CompileOptions() []cel.EnvOption
- func (*SemverTool) ConvertToNative(_ reflect.Type) (any, error)
- func (st *SemverTool) ConvertToType(typeVal ref.Type) ref.Val
- func (*SemverTool) Equal(_ ref.Val) ref.Val
- func (st *SemverTool) Functions() []cel.EnvOption
- func (*SemverTool) ProgramOptions() []cel.ProgramOption
- func (*SemverTool) Type() ref.Type
- func (st *SemverTool) Value() any
- type TypeAdapter
Constants ¶
This section is empty.
Variables ¶
var SemverType = cel.ObjectType("semver", traits.ReceiverType)
SemverType is the CEL object type registered for the `semver` global. Like the other plugin tools, it is an opaque handle the CEL compiler uses to dispatch method calls.
Functions ¶
This section is empty.
Types ¶
type Plugin ¶
type Plugin struct {
Tool *SemverTool
}
Plugin wires the semver tool into ampel's CEL evaluator.
func (*Plugin) Capabilities ¶
func (p *Plugin) Capabilities() []api.Capability
type SemverTool ¶
type SemverTool struct{}
SemverTool is the host object for the `semver.*` methods in CEL.
func (*SemverTool) CompileOptions ¶
func (st *SemverTool) CompileOptions() []cel.EnvOption
func (*SemverTool) ConvertToNative ¶
func (*SemverTool) ConvertToNative(_ reflect.Type) (any, error)
func (*SemverTool) ConvertToType ¶
func (st *SemverTool) ConvertToType(typeVal ref.Type) ref.Val
func (*SemverTool) Functions ¶
func (st *SemverTool) Functions() []cel.EnvOption
Functions registers the member overloads exposed on the semver object. Every accessor accepts a string and either returns a numeric/string component or a bool — the failure mode for an unparseable input is a CEL error that surfaces at evaluation time.
func (*SemverTool) ProgramOptions ¶
func (*SemverTool) ProgramOptions() []cel.ProgramOption
func (*SemverTool) Type ¶
func (*SemverTool) Type() ref.Type
func (*SemverTool) Value ¶
func (st *SemverTool) Value() any
type TypeAdapter ¶
type TypeAdapter struct{}
TypeAdapter registers SemverTool with CEL's runtime type system.
func (TypeAdapter) NativeToValue ¶
func (TypeAdapter) NativeToValue(value any) ref.Val