schema

package
v0.492.1 Latest Latest
Warning

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

Go to latest
Published: May 13, 2025 License: Apache-2.0 Imports: 44 Imported by: 0

Documentation ¶

Index ¶

Constants ¶

View Source
const (
	DefaultRetryCount  = 10
	MinBackoffLimitStr = "1s"
	MinBackoffLimit    = 1 * time.Second
	DefaultMaxBackoff  = 1 * time.Hour
	MaxBackoffLimitStr = "1d"
	MaxBackoffLimit    = 24 * time.Hour
)
View Source
const BuiltinsSource = `` /* 955-byte string literal not displayed */

BuiltinsSource is the schema source code for built-in types.

View Source
const MySQLDatabaseType = "mysql"
View Source
const PostgresDatabaseType = "postgres"

Variables ¶

View Source
var ErrNotFound = errors.New("not found")
View Source
var (
	Lexer = lexer.MustSimple([]lexer.SimpleRule{
		{Name: "EOL", Pattern: `[\r\n]`},
		{Name: "SHA256", Pattern: `\b[A-za-z0-9]{64}\b`},
		{Name: "Whitespace", Pattern: `\s+`},
		{Name: "Ident", Pattern: `\b[a-zA-Z_][a-zA-Z0-9_]*\b`},
		{Name: "Comment", Pattern: `//.*`},
		{Name: "String", Pattern: `"(?:\\.|[^"])*"`},
		{Name: "Number", Pattern: `[0-9]+(?:\.[0-9]+)?`},
		{Name: "Punct", Pattern: `[%/\-\_:[\]{}<>()*+?.,\\^$|#~!\'@=]`},
	})
)

Functions ¶

func AliasKindStrings ¶

func AliasKindStrings() []string

AliasKindStrings returns a slice of all String values of the enum

func DatabaseConnectorToProto ¶

func DatabaseConnectorToProto(value DatabaseConnector) *destpb.DatabaseConnector

DatabaseConnectorToProto converts a DatabaseConnector sum type to a protobuf message.

func DeadLetterNameForSubscriber ¶ added in v0.414.0

func DeadLetterNameForSubscriber(verb string) string

func DeclToProto ¶

func DeclToProto(value Decl) *destpb.Decl

DeclToProto converts a Decl sum type to a protobuf message.

func EBNF ¶ added in v0.460.0

func EBNF() string

EBNF grammar for the FTL schema.

func EncodeComments ¶

func EncodeComments(comments []string) string

func EventToProto ¶ added in v0.434.0

func EventToProto(value Event) *destpb.Event

EventToProto converts a Event sum type to a protobuf message.

func GetProvisioned ¶

func GetProvisioned(root Node) map[string]Provisioned

func Graph ¶ added in v0.434.0

func Graph(s *Schema) map[RefKey]GraphNode

Graph returns a biderectional graph representation of the schema.

func IngressPathComponentToProto ¶

func IngressPathComponentToProto(value IngressPathComponent) *destpb.IngressPathComponent

IngressPathComponentToProto converts a IngressPathComponent sum type to a protobuf message.

func MetadataToProto ¶

func MetadataToProto(value Metadata) *destpb.Metadata

MetadataToProto converts a Metadata sum type to a protobuf message.

func ModuleToBytes ¶

func ModuleToBytes(m *Module) ([]byte, error)

func Normalise ¶

func Normalise[T Node](n T) T

Normalise clones and normalises (zeroes) positional information in schema Nodes.

func NotificationToProto ¶ added in v0.439.0

func NotificationToProto(value Notification) *destpb.Notification

NotificationToProto converts a Notification sum type to a protobuf message.

func Redact ¶

func Redact[T Node](n T) T

Redact clones n and recursively removes sensitive information from it.

Any node that implements the Redactable interface will have its Redact method called.

func RequestResponseToJSONSchema ¶

func RequestResponseToJSONSchema(sch *Schema, ref Ref) (*jsonschema.Schema, error)

RequestResponseToJSONSchema converts the schema for a Verb request or response object to a JSON Schema.

It takes in the full schema in order to resolve and define references.

func RuntimeToProto ¶ added in v0.439.0

func RuntimeToProto(value Runtime) *destpb.Runtime

RuntimeToProto converts a Runtime sum type to a protobuf message.

func SortModuleDecls ¶

func SortModuleDecls(module *Module)

SortModuleDecls sorts the declarations in a module.

func SubscriptionConnectorToProto ¶ added in v0.461.0

func SubscriptionConnectorToProto(value SubscriptionConnector) *destpb.SubscriptionConnector

SubscriptionConnectorToProto converts a SubscriptionConnector sum type to a protobuf message.

func TransformAliasedFields ¶

func TransformAliasedFields(sch *Schema, t Type, obj any, aliaser func(obj map[string]any, field *Field) string) error

func TransformFromAliasedFields ¶

func TransformFromAliasedFields(sch *Schema, t Type, request map[string]any) (map[string]any, error)

func TransformToAliasedFields ¶

func TransformToAliasedFields(sch *Schema, t Type, request map[string]any) (map[string]any, error)

func TypeName ¶

func TypeName(v any) string

TypeName returns the name of a type as a string, stripping any package prefix and correctly handling Ref aliases.

func TypeToProto ¶

func TypeToProto(value Type) *destpb.Type

TypeToProto converts a Type sum type to a protobuf message.

func ValidateJSONCall ¶ added in v0.466.0

func ValidateJSONCall(jsonBytes []byte, verbRef *Ref, sch *Schema) error

ValidateJSONCall validates a given JSON request against the provided schema when calling a verb.

func ValidateJSONValue ¶

func ValidateJSONValue(fieldType Type, path path, value any, sch *Schema, opts ...EncodingOption) error

ValidateJSONValue validates a given JSON value against the provided schema.

func ValidateModuleName ¶ added in v0.435.0

func ValidateModuleName(name string) bool

ValidateModuleName validates an FTL module name.

func ValidateName ¶

func ValidateName(name string) bool

ValidateName validates an FTL name.

func ValidateRequestMap ¶

func ValidateRequestMap(ref *Ref, path path, request map[string]any, sch *Schema, opts ...EncodingOption) error

ValidateRequestMap validates a given JSON map against the provided schema.

func ValueToProto ¶

func ValueToProto(value Value) *destpb.Value

ValueToProto converts a Value sum type to a protobuf message.

func Visit ¶

func Visit(n Node, visit func(n Node, next func() error) error) error

Visit all nodes in the schema.

func VisitExcludingMetadataChildren ¶

func VisitExcludingMetadataChildren(n Node, visit func(n Node, next func() error) error) error

VisitExcludingMetadataChildren visits all nodes in the schema except the children of metadata nodes. This is used when generating external modules to avoid adding imports only referenced in the bodies of stubbed verbs.

func VisitWithParents ¶ added in v0.455.6

func VisitWithParents(n Node, parents []Node, visit func(n Node, parents []Node, next func() error) error) error

VisitWithParents visits all nodes in the schema providing the parent nodes on each visit

Types ¶

type AWSIAMAuthDatabaseConnector ¶

type AWSIAMAuthDatabaseConnector struct {
	Pos Position `parser:"" protobuf:"1,optional"`

	Username string `parser:"" protobuf:"2"`
	Endpoint string `parser:"" protobuf:"3"`
	Database string `parser:"" protobuf:"4"`
}

func AWSIAMAuthDatabaseConnectorFromProto ¶ added in v0.424.0

func AWSIAMAuthDatabaseConnectorFromProto(v *destpb.AWSIAMAuthDatabaseConnector) (out *AWSIAMAuthDatabaseConnector, err error)

func (*AWSIAMAuthDatabaseConnector) Position ¶

func (d *AWSIAMAuthDatabaseConnector) Position() Position

func (*AWSIAMAuthDatabaseConnector) String ¶

func (d *AWSIAMAuthDatabaseConnector) String() string

func (*AWSIAMAuthDatabaseConnector) ToProto ¶

type AliasKind ¶

type AliasKind int

AliasKind is the kind of alias.

const (
	AliasKindUnspecified AliasKind = iota
	AliasKindJSON
)

func AliasKindFromProto ¶ added in v0.424.0

func AliasKindFromProto(v destpb.AliasKind) (AliasKind, error)

func AliasKindString ¶

func AliasKindString(s string) (AliasKind, error)

AliasKindString retrieves an enum value from the enum constants string name. Throws an error if the param is not part of the enum.

func AliasKindValues ¶

func AliasKindValues() []AliasKind

AliasKindValues returns all values of the enum

func (AliasKind) IsAAliasKind ¶

func (i AliasKind) IsAAliasKind() bool

IsAAliasKind returns "true" if the value is listed in the enum definition. "false" otherwise

func (AliasKind) MarshalJSON ¶

func (i AliasKind) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface for AliasKind

func (AliasKind) MarshalText ¶

func (i AliasKind) MarshalText() ([]byte, error)

MarshalText implements the encoding.TextMarshaler interface for AliasKind

func (AliasKind) String ¶

func (i AliasKind) String() string

func (AliasKind) ToProto ¶

func (x AliasKind) ToProto() destpb.AliasKind

func (*AliasKind) UnmarshalJSON ¶

func (i *AliasKind) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaler interface for AliasKind

func (*AliasKind) UnmarshalText ¶

func (i *AliasKind) UnmarshalText(text []byte) error

UnmarshalText implements the encoding.TextUnmarshaler interface for AliasKind

type Any ¶

type Any struct {
	Pos Position `parser:"" protobuf:"1,optional"`

	Any bool `parser:"@'Any'" protobuf:"-"`
}

func AnyFromProto ¶ added in v0.424.0

func AnyFromProto(v *destpb.Any) (out *Any, err error)

func (*Any) Equal ¶

func (*Any) Equal(other Type) bool

func (*Any) GetName ¶

func (*Any) GetName() string

func (*Any) Kind ¶ added in v0.477.0

func (*Any) Kind() Kind

func (*Any) Position ¶

func (a *Any) Position() Position

func (*Any) String ¶

func (*Any) String() string

func (*Any) ToProto ¶

func (x *Any) ToProto() *destpb.Any

type Array ¶

type Array struct {
	Pos Position `parser:"" protobuf:"1,optional"`

	Element Type `parser:"'[' @@ ']'" protobuf:"2"`
}

func ArrayFromProto ¶ added in v0.424.0

func ArrayFromProto(v *destpb.Array) (out *Array, err error)

func (*Array) Equal ¶

func (a *Array) Equal(other Type) bool

func (*Array) Kind ¶ added in v0.477.0

func (a *Array) Kind() Kind

func (*Array) Position ¶

func (a *Array) Position() Position

func (*Array) String ¶

func (a *Array) String() string

func (*Array) ToProto ¶

func (x *Array) ToProto() *destpb.Array

type Bool ¶

type Bool struct {
	Pos Position `parser:"" protobuf:"1,optional"`

	Bool bool `parser:"@'Bool'" protobuf:"-"`
}

func BoolFromProto ¶ added in v0.424.0

func BoolFromProto(v *destpb.Bool) (out *Bool, err error)

func (*Bool) Equal ¶

func (b *Bool) Equal(other Type) bool

func (*Bool) GetName ¶

func (*Bool) GetName() string

func (*Bool) Kind ¶ added in v0.477.0

func (*Bool) Kind() Kind

func (*Bool) Position ¶

func (b *Bool) Position() Position

func (*Bool) String ¶

func (*Bool) String() string

func (*Bool) ToProto ¶

func (x *Bool) ToProto() *destpb.Bool

type Bytes ¶

type Bytes struct {
	Pos Position `parser:"" protobuf:"1,optional"`

	Bytes bool `parser:"@'Bytes'" protobuf:"-"`
}

func BytesFromProto ¶ added in v0.424.0

func BytesFromProto(v *destpb.Bytes) (out *Bytes, err error)

func (*Bytes) Equal ¶

func (b *Bytes) Equal(other Type) bool

func (*Bytes) GetName ¶

func (*Bytes) GetName() string

func (*Bytes) Kind ¶ added in v0.477.0

func (*Bytes) Kind() Kind

func (*Bytes) Position ¶

func (b *Bytes) Position() Position

func (*Bytes) String ¶

func (*Bytes) String() string

func (*Bytes) ToProto ¶

func (x *Bytes) ToProto() *destpb.Bytes

type Changeset ¶ added in v0.435.0

type Changeset struct {
	Key       key.Changeset `protobuf:"1"`
	CreatedAt time.Time     `protobuf:"2"`
	// RealmChanges is the list of realm changes in this changeset.
	RealmChanges []*RealmChange `protobuf:"3"`
	// State the changeset state
	State ChangesetState `protobuf:"4"`
	// Error is present if state is failed.
	Error string `protobuf:"5,optional"`
}

func ChangesetFromProto ¶ added in v0.435.0

func ChangesetFromProto(v *destpb.Changeset) (out *Changeset, err error)

func (*Changeset) InternalRealm ¶ added in v0.477.0

func (c *Changeset) InternalRealm() *RealmChange

InternalRealm returns the internal realm for the given changeset.

For now, all changesets have exactly one internal realm change.

func (*Changeset) ModulesAreCanonical ¶ added in v0.436.0

func (c *Changeset) ModulesAreCanonical() bool

ModulesAreCanonical returns true if the changeset is in a state when there the Modules field is the canonical state of the modules.

func (*Changeset) OwnedModules ¶ added in v0.436.0

func (c *Changeset) OwnedModules(realm *RealmChange) []*Module

OwnedModules returns the modules that are owned by this changeset for the given realm. Depending on the state this may be the added modules list or the removing modules list.

func (*Changeset) Realm ¶ added in v0.477.0

func (c *Changeset) Realm(name string) optional.Option[*RealmChange]

Realm returns the realm change for the given name.

func (*Changeset) ToProto ¶ added in v0.435.0

func (x *Changeset) ToProto() *destpb.Changeset

type ChangesetCommittedEvent ¶ added in v0.435.0

type ChangesetCommittedEvent struct {
	Key key.Changeset `protobuf:"1"`
}

func ChangesetCommittedEventFromProto ¶ added in v0.435.0

func ChangesetCommittedEventFromProto(v *destpb.ChangesetCommittedEvent) (out *ChangesetCommittedEvent, err error)

func (*ChangesetCommittedEvent) DebugString ¶ added in v0.438.0

func (e *ChangesetCommittedEvent) DebugString() string

func (*ChangesetCommittedEvent) ToProto ¶ added in v0.435.0

func (*ChangesetCommittedEvent) Validate ¶ added in v0.435.0

func (e *ChangesetCommittedEvent) Validate() error

type ChangesetCommittedNotification ¶ added in v0.439.0

type ChangesetCommittedNotification struct {
	Changeset *Changeset `protobuf:"1"`
}

func ChangesetCommittedNotificationFromProto ¶ added in v0.439.0

func ChangesetCommittedNotificationFromProto(v *destpb.ChangesetCommittedNotification) (out *ChangesetCommittedNotification, err error)

func (*ChangesetCommittedNotification) ToProto ¶ added in v0.439.0

type ChangesetCreatedEvent ¶ added in v0.435.0

type ChangesetCreatedEvent struct {
	Changeset *Changeset `protobuf:"1"`
}

func ChangesetCreatedEventFromProto ¶ added in v0.435.0

func ChangesetCreatedEventFromProto(v *destpb.ChangesetCreatedEvent) (out *ChangesetCreatedEvent, err error)

func (*ChangesetCreatedEvent) DebugString ¶ added in v0.438.0

func (e *ChangesetCreatedEvent) DebugString() string

func (*ChangesetCreatedEvent) ToProto ¶ added in v0.435.0

func (*ChangesetCreatedEvent) Validate ¶ added in v0.435.0

func (e *ChangesetCreatedEvent) Validate() error

type ChangesetCreatedNotification ¶ added in v0.439.0

type ChangesetCreatedNotification struct {
	Changeset *Changeset `protobuf:"1"`
}

func ChangesetCreatedNotificationFromProto ¶ added in v0.439.0

func ChangesetCreatedNotificationFromProto(v *destpb.ChangesetCreatedNotification) (out *ChangesetCreatedNotification, err error)

func (*ChangesetCreatedNotification) ToProto ¶ added in v0.439.0

type ChangesetDrainedEvent ¶ added in v0.436.0

type ChangesetDrainedEvent struct {
	Key key.Changeset `protobuf:"1"`
}

func ChangesetDrainedEventFromProto ¶ added in v0.436.0

func ChangesetDrainedEventFromProto(v *destpb.ChangesetDrainedEvent) (out *ChangesetDrainedEvent, err error)

func (*ChangesetDrainedEvent) DebugString ¶ added in v0.438.0

func (e *ChangesetDrainedEvent) DebugString() string

func (*ChangesetDrainedEvent) ToProto ¶ added in v0.436.0

func (*ChangesetDrainedEvent) Validate ¶ added in v0.436.0

func (e *ChangesetDrainedEvent) Validate() error

type ChangesetDrainedNotification ¶ added in v0.439.0

type ChangesetDrainedNotification struct {
	Key key.Changeset `protobuf:"1"`
}

func ChangesetDrainedNotificationFromProto ¶ added in v0.439.0

func ChangesetDrainedNotificationFromProto(v *destpb.ChangesetDrainedNotification) (out *ChangesetDrainedNotification, err error)

func (*ChangesetDrainedNotification) ToProto ¶ added in v0.439.0

type ChangesetFailedEvent ¶ added in v0.435.0

type ChangesetFailedEvent struct {
	Key key.Changeset `protobuf:"1"`
}

func ChangesetFailedEventFromProto ¶ added in v0.435.0

func ChangesetFailedEventFromProto(v *destpb.ChangesetFailedEvent) (out *ChangesetFailedEvent, err error)

func (*ChangesetFailedEvent) DebugString ¶ added in v0.438.0

func (e *ChangesetFailedEvent) DebugString() string

func (*ChangesetFailedEvent) ToProto ¶ added in v0.435.0

func (*ChangesetFailedEvent) Validate ¶ added in v0.435.0

func (e *ChangesetFailedEvent) Validate() error

type ChangesetFailedNotification ¶ added in v0.439.0

type ChangesetFailedNotification struct {
	Key   key.Changeset `protobuf:"1"`
	Error string        `protobuf:"2"`
}

func ChangesetFailedNotificationFromProto ¶ added in v0.439.0

func ChangesetFailedNotificationFromProto(v *destpb.ChangesetFailedNotification) (out *ChangesetFailedNotification, err error)

func (*ChangesetFailedNotification) ToProto ¶ added in v0.439.0

type ChangesetFinalizedEvent ¶ added in v0.436.0

type ChangesetFinalizedEvent struct {
	Key key.Changeset `protobuf:"1"`
}

func ChangesetFinalizedEventFromProto ¶ added in v0.436.0

func ChangesetFinalizedEventFromProto(v *destpb.ChangesetFinalizedEvent) (out *ChangesetFinalizedEvent, err error)

func (*ChangesetFinalizedEvent) DebugString ¶ added in v0.438.0

func (e *ChangesetFinalizedEvent) DebugString() string

func (*ChangesetFinalizedEvent) ToProto ¶ added in v0.436.0

func (*ChangesetFinalizedEvent) Validate ¶ added in v0.436.0

func (e *ChangesetFinalizedEvent) Validate() error

type ChangesetFinalizedNotification ¶ added in v0.439.0

type ChangesetFinalizedNotification struct {
	Key key.Changeset `protobuf:"1"`
}

func ChangesetFinalizedNotificationFromProto ¶ added in v0.439.0

func ChangesetFinalizedNotificationFromProto(v *destpb.ChangesetFinalizedNotification) (out *ChangesetFinalizedNotification, err error)

func (*ChangesetFinalizedNotification) ToProto ¶ added in v0.439.0

type ChangesetPreparedEvent ¶ added in v0.435.0

type ChangesetPreparedEvent struct {
	Key key.Changeset `protobuf:"1"`
}

func ChangesetPreparedEventFromProto ¶ added in v0.435.0

func ChangesetPreparedEventFromProto(v *destpb.ChangesetPreparedEvent) (out *ChangesetPreparedEvent, err error)

func (*ChangesetPreparedEvent) DebugString ¶ added in v0.438.0

func (e *ChangesetPreparedEvent) DebugString() string

func (*ChangesetPreparedEvent) ToProto ¶ added in v0.435.0

func (*ChangesetPreparedEvent) Validate ¶ added in v0.435.0

func (e *ChangesetPreparedEvent) Validate() error

type ChangesetPreparedNotification ¶ added in v0.439.0

type ChangesetPreparedNotification struct {
	Key key.Changeset `protobuf:"1"`
}

func ChangesetPreparedNotificationFromProto ¶ added in v0.439.0

func ChangesetPreparedNotificationFromProto(v *destpb.ChangesetPreparedNotification) (out *ChangesetPreparedNotification, err error)

func (*ChangesetPreparedNotification) DebugString ¶ added in v0.439.0

func (e *ChangesetPreparedNotification) DebugString() string

func (*ChangesetPreparedNotification) ToProto ¶ added in v0.439.0

type ChangesetRollingBackEvent ¶ added in v0.442.0

type ChangesetRollingBackEvent struct {
	Key   key.Changeset `protobuf:"1"`
	Error string        `protobuf:"2"`
}

func ChangesetRollingBackEventFromProto ¶ added in v0.442.0

func ChangesetRollingBackEventFromProto(v *destpb.ChangesetRollingBackEvent) (out *ChangesetRollingBackEvent, err error)

func (*ChangesetRollingBackEvent) DebugString ¶ added in v0.442.0

func (e *ChangesetRollingBackEvent) DebugString() string

func (*ChangesetRollingBackEvent) ToProto ¶ added in v0.442.0

func (*ChangesetRollingBackEvent) Validate ¶ added in v0.442.0

func (e *ChangesetRollingBackEvent) Validate() error

type ChangesetRollingBackNotification ¶ added in v0.439.0

type ChangesetRollingBackNotification struct {
	Changeset *Changeset `protobuf:"1"`
	Error     string     `protobuf:"2"`
}

func ChangesetRollingBackNotificationFromProto ¶ added in v0.439.0

func ChangesetRollingBackNotificationFromProto(v *destpb.ChangesetRollingBackNotification) (out *ChangesetRollingBackNotification, err error)

func (*ChangesetRollingBackNotification) ToProto ¶ added in v0.439.0

type ChangesetState ¶ added in v0.435.0

type ChangesetState int
const (
	ChangesetStateUnspecified ChangesetState = iota
	ChangesetStatePreparing
	ChangesetStatePrepared
	ChangesetStateCommitted
	ChangesetStateDrained
	ChangesetStateFinalized
	ChangesetStateRollingBack
	ChangesetStateFailed
)

func ChangesetStateFromProto ¶ added in v0.435.0

func ChangesetStateFromProto(v destpb.ChangesetState) (ChangesetState, error)

func (ChangesetState) String ¶ added in v0.477.0

func (s ChangesetState) String() string

func (ChangesetState) ToProto ¶ added in v0.435.0

func (x ChangesetState) ToProto() destpb.ChangesetState

type Config ¶

type Config struct {
	Pos Position `parser:"" protobuf:"1,optional"`

	Comments []string `parser:"@Comment*" protobuf:"2"`
	Name     string   `parser:"'config' @Ident" protobuf:"3"`
	Type     Type     `parser:"@@" protobuf:"4"`
}

func ConfigFromProto ¶

func ConfigFromProto(v *destpb.Config) (out *Config, err error)

func (*Config) GetName ¶

func (s *Config) GetName() string

func (*Config) GetVisibility ¶ added in v0.480.0

func (s *Config) GetVisibility() Visibility

func (*Config) IsGenerated ¶ added in v0.464.0

func (s *Config) IsGenerated() bool

func (*Config) Position ¶

func (s *Config) Position() Position

func (*Config) String ¶

func (s *Config) String() string

func (*Config) ToProto ¶

func (x *Config) ToProto() *destpb.Config

func (*Config) Validate ¶ added in v0.486.0

func (s *Config) Validate() error

type DSNDatabaseConnector ¶

type DSNDatabaseConnector struct {
	Pos Position `parser:"" protobuf:"1,optional"`

	Database string `parser:"" protobuf:"2"`
	DSN      string `parser:"" protobuf:"3"`
}

func DSNDatabaseConnectorFromProto ¶ added in v0.424.0

func DSNDatabaseConnectorFromProto(v *destpb.DSNDatabaseConnector) (out *DSNDatabaseConnector, err error)

func (*DSNDatabaseConnector) Position ¶

func (d *DSNDatabaseConnector) Position() Position

func (*DSNDatabaseConnector) String ¶

func (d *DSNDatabaseConnector) String() string

func (*DSNDatabaseConnector) ToProto ¶

type Data ¶

type Data struct {
	Pos Position `parser:"" protobuf:"1,optional"`

	Comments       []string         `parser:"@Comment*" protobuf:"2"`
	Visibility     Visibility       `parser:"@@?" protobuf:"3"`
	Name           string           `parser:"'data' @Ident" protobuf:"4"`
	TypeParameters []*TypeParameter `parser:"( '<' @@ (',' @@)* '>' )? '{'" protobuf:"5"`
	Metadata       []Metadata       `parser:"@@*" protobuf:"7"`
	Fields         []*Field         `parser:"@@* '}'" protobuf:"6"`
}

A Data structure.

func DataFromProto ¶

func DataFromProto(v *destpb.Data) (out *Data, err error)

func (*Data) Equal ¶ added in v0.477.0

func (d *Data) Equal(other Type) bool

func (*Data) FieldByName ¶

func (d *Data) FieldByName(name string) *Field

FieldByName returns the field with the given name, or nil if it doesn't exist.

func (*Data) GetName ¶

func (d *Data) GetName() string

func (*Data) GetVisibility ¶ added in v0.480.0

func (d *Data) GetVisibility() Visibility

func (*Data) IsGenerated ¶ added in v0.464.0

func (d *Data) IsGenerated() bool

func (*Data) Kind ¶ added in v0.477.0

func (d *Data) Kind() Kind

func (*Data) Monomorphise ¶

func (d *Data) Monomorphise(ref *Ref) (*Data, error)

Monomorphise this data type with the given type arguments.

If this data type has no type parameters, it will be returned as-is.

This will return a new Data structure with all type parameters replaced with the given types.

func (*Data) Position ¶

func (d *Data) Position() Position

func (*Data) Scope ¶

func (d *Data) Scope() Scope

func (*Data) String ¶

func (d *Data) String() string

func (*Data) ToProto ¶

func (x *Data) ToProto() *destpb.Data

type Database ¶

type Database struct {
	Pos     Position         `parser:"" protobuf:"1,optional"`
	Runtime *DatabaseRuntime `parser:"" protobuf:"31634,optional"`

	Comments []string   `parser:"@Comment*" protobuf:"2"`
	Type     string     `parser:"'database' @('postgres'|'mysql')" protobuf:"4"`
	Name     string     `parser:"@Ident" protobuf:"3"`
	Metadata []Metadata `parser:"@@*" protobuf:"5"`
}

func DatabaseFromProto ¶

func DatabaseFromProto(v *destpb.Database) (out *Database, err error)

func (*Database) GetName ¶

func (d *Database) GetName() string

func (*Database) GetProvisioned ¶

func (d *Database) GetProvisioned() ResourceSet

func (*Database) GetVisibility ¶ added in v0.480.0

func (d *Database) GetVisibility() Visibility

func (*Database) IsGenerated ¶ added in v0.464.0

func (d *Database) IsGenerated() bool

func (*Database) Position ¶

func (d *Database) Position() Position

func (*Database) ResourceID ¶

func (d *Database) ResourceID() string

func (*Database) String ¶

func (d *Database) String() string

func (*Database) ToProto ¶

func (x *Database) ToProto() *destpb.Database

type DatabaseConnector ¶

type DatabaseConnector interface {
	Node
	// contains filtered or unexported methods
}

func DatabaseConnectorFromProto ¶

func DatabaseConnectorFromProto(v *destpb.DatabaseConnector) (DatabaseConnector, error)

type DatabaseRuntime ¶

type DatabaseRuntime struct {
	Connections *DatabaseRuntimeConnections `parser:"" protobuf:"1,optional"`
}

func DatabaseRuntimeFromProto ¶

func DatabaseRuntimeFromProto(v *destpb.DatabaseRuntime) (out *DatabaseRuntime, err error)

func (*DatabaseRuntime) Position ¶

func (d *DatabaseRuntime) Position() Position

func (*DatabaseRuntime) String ¶

func (d *DatabaseRuntime) String() string

func (*DatabaseRuntime) ToProto ¶

func (x *DatabaseRuntime) ToProto() *destpb.DatabaseRuntime

type DatabaseRuntimeConnections ¶

type DatabaseRuntimeConnections struct {
	Read  DatabaseConnector `parser:"" protobuf:"1"`
	Write DatabaseConnector `parser:"" protobuf:"2"`
}

func DatabaseRuntimeConnectionsFromProto ¶

func DatabaseRuntimeConnectionsFromProto(v *destpb.DatabaseRuntimeConnections) (out *DatabaseRuntimeConnections, err error)

func (*DatabaseRuntimeConnections) Position ¶

func (d *DatabaseRuntimeConnections) Position() Position

func (*DatabaseRuntimeConnections) String ¶

func (d *DatabaseRuntimeConnections) String() string

func (*DatabaseRuntimeConnections) ToProto ¶

type Decl ¶

type Decl interface {
	Symbol
	GetName() string
	// IsGenerated returns true if the Decl is in the schema but not in the source code.
	IsGenerated() bool
	GetVisibility() Visibility
	// contains filtered or unexported methods
}

Decl represents user-defined data types in the schema grammar.

func DeclFromProto ¶ added in v0.424.0

func DeclFromProto(v *destpb.Decl) (Decl, error)

type DeclResolver ¶ added in v0.485.0

type DeclResolver interface {
	ResolveWithModule(ref *Ref) (optional.Option[Decl], optional.Option[*Module])
}

DeclResolver optionally resolves a Ref to a Decl.

type DeploymentRuntimeEvent ¶ added in v0.439.0

type DeploymentRuntimeEvent struct {
	Payload   *RuntimeElement `protobuf:"1"`
	Changeset *key.Changeset  `protobuf:"2"`
}

func DeploymentRuntimeEventFromProto ¶ added in v0.439.0

func DeploymentRuntimeEventFromProto(v *destpb.DeploymentRuntimeEvent) (out *DeploymentRuntimeEvent, err error)

func (*DeploymentRuntimeEvent) ChangesetKey ¶ added in v0.439.0

func (e *DeploymentRuntimeEvent) ChangesetKey() optional.Option[key.Changeset]

func (*DeploymentRuntimeEvent) DebugString ¶ added in v0.439.0

func (e *DeploymentRuntimeEvent) DebugString() string

func (*DeploymentRuntimeEvent) DeploymentKey ¶ added in v0.439.0

func (e *DeploymentRuntimeEvent) DeploymentKey() key.Deployment

func (*DeploymentRuntimeEvent) ToProto ¶ added in v0.439.0

func (*DeploymentRuntimeEvent) Validate ¶ added in v0.439.0

func (e *DeploymentRuntimeEvent) Validate() error

type DeploymentRuntimeNotification ¶ added in v0.439.0

type DeploymentRuntimeNotification struct {
	Payload   *RuntimeElement `protobuf:"1"`
	Changeset *key.Changeset  `protobuf:"2"`
}

func DeploymentRuntimeNotificationFromProto ¶ added in v0.439.0

func DeploymentRuntimeNotificationFromProto(v *destpb.DeploymentRuntimeNotification) (out *DeploymentRuntimeNotification, err error)

func (*DeploymentRuntimeNotification) ToProto ¶ added in v0.439.0

type DeploymentState ¶ added in v0.435.0

type DeploymentState int
const (
	DeploymentStateUnspecified DeploymentState = iota
	DeploymentStateProvisioning
	DeploymentStateReady
	DeploymentStateCanary
	DeploymentStateCanonical
	DeploymentStateDraining
	DeploymentStateDeProvisioning
	DeploymentStateDeleted
	DeploymentStateFailed
)

func DeploymentStateFromProto ¶ added in v0.435.0

func DeploymentStateFromProto(v destpb.DeploymentState) (DeploymentState, error)

func (DeploymentState) ToProto ¶ added in v0.435.0

type EgressRuntime ¶ added in v0.477.0

type EgressRuntime struct {
	Targets []EgressTarget `protobuf:"1"`
}

EgressRuntime stores the actual egress target.

func EgressRuntimeFromProto ¶ added in v0.477.0

func EgressRuntimeFromProto(v *destpb.EgressRuntime) (out *EgressRuntime, err error)

func (*EgressRuntime) ToProto ¶ added in v0.477.0

func (x *EgressRuntime) ToProto() *destpb.EgressRuntime

type EgressTarget ¶ added in v0.477.0

type EgressTarget struct {
	Expression string `protobuf:"1"`
	Target     string `protobuf:"2"`
}

func EgressTargetFromProto ¶ added in v0.477.0

func EgressTargetFromProto(v *destpb.EgressTarget) (out *EgressTarget, err error)

func (*EgressTarget) ToProto ¶ added in v0.477.0

func (x *EgressTarget) ToProto() *destpb.EgressTarget

type EncodingOption ¶

type EncodingOption func(option *encodingOptions)

func LenientMode ¶

func LenientMode() EncodingOption

type Enum ¶

type Enum struct {
	Pos Position `parser:"" protobuf:"1,optional"`

	Comments   []string       `parser:"@Comment*" protobuf:"2"`
	Visibility Visibility     `parser:"@@?" protobuf:"3"`
	Name       string         `parser:"'enum' @Ident" protobuf:"4"`
	Type       Type           `parser:"(':' @@)?" protobuf:"5,optional"`
	Variants   []*EnumVariant `parser:"'{' @@* '}'" protobuf:"6"`
}

func EnumFromProto ¶

func EnumFromProto(v *destpb.Enum) (out *Enum, err error)

func (*Enum) Equal ¶ added in v0.477.0

func (e *Enum) Equal(other Type) bool

func (*Enum) GetName ¶

func (e *Enum) GetName() string

func (*Enum) GetVisibility ¶ added in v0.480.0

func (e *Enum) GetVisibility() Visibility

func (*Enum) IsGenerated ¶ added in v0.464.0

func (e *Enum) IsGenerated() bool

func (*Enum) IsValueEnum ¶

func (e *Enum) IsValueEnum() bool

IsValueEnum determines whether this is a type or value enum using `e.Type` alone because value enums must always have a unified type across all variants, whereas type enums by definition cannot have a unified type.

func (*Enum) Kind ¶ added in v0.477.0

func (*Enum) Kind() Kind

func (*Enum) Position ¶

func (e *Enum) Position() Position

func (*Enum) String ¶

func (e *Enum) String() string

func (*Enum) ToProto ¶

func (x *Enum) ToProto() *destpb.Enum

func (*Enum) VariantForName ¶

func (e *Enum) VariantForName(name string) optional.Option[*EnumVariant]

type EnumVariant ¶

type EnumVariant struct {
	Pos Position `parser:"" protobuf:"1,optional"`

	Comments []string `parser:"@Comment*" protobuf:"2"`
	Name     string   `parser:"@Ident" protobuf:"3"`
	Value    Value    `parser:"(('=' @@) | @@)!" protobuf:"4"`
}

func EnumVariantFromProto ¶ added in v0.424.0

func EnumVariantFromProto(v *destpb.EnumVariant) (out *EnumVariant, err error)

func (*EnumVariant) Equal ¶ added in v0.477.0

func (e *EnumVariant) Equal(o *EnumVariant) bool

Equal implements Type.

func (*EnumVariant) Position ¶

func (e *EnumVariant) Position() Position

func (*EnumVariant) String ¶

func (e *EnumVariant) String() string

func (*EnumVariant) ToProto ¶

func (x *EnumVariant) ToProto() *destpb.EnumVariant

type Event ¶ added in v0.434.0

type Event interface {

	// Validate the event is internally consistent
	Validate() error
	// DebugString returns a string representation of the event for debugging purposes
	DebugString() string
	// contains filtered or unexported methods
}

func EventFromProto ¶ added in v0.434.0

func EventFromProto(v *destpb.Event) (Event, error)

type Field ¶

type Field struct {
	Pos Position `parser:"" protobuf:"1,optional"`

	Comments []string   `parser:"@Comment*" protobuf:"3"`
	Name     string     `parser:"@Ident" protobuf:"2"`
	Type     Type       `parser:"@@" protobuf:"4"`
	Metadata []Metadata `parser:"@@*" protobuf:"5"`
}

func FieldFromProto ¶ added in v0.424.0

func FieldFromProto(v *destpb.Field) (out *Field, err error)

func (*Field) Alias ¶

func (f *Field) Alias(kind AliasKind) optional.Option[string]

Alias returns the alias for the given kind.

func (*Field) Position ¶

func (f *Field) Position() Position

func (*Field) String ¶

func (f *Field) String() string

func (*Field) ToProto ¶

func (x *Field) ToProto() *destpb.Field

type Float ¶

type Float struct {
	Pos Position `parser:"" protobuf:"1,optional"`

	Float bool `parser:"@'Float'" protobuf:"-"`
}

func FloatFromProto ¶ added in v0.424.0

func FloatFromProto(v *destpb.Float) (out *Float, err error)

func (*Float) Equal ¶

func (f *Float) Equal(other Type) bool

func (*Float) GetName ¶

func (*Float) GetName() string

func (*Float) Kind ¶ added in v0.477.0

func (*Float) Kind() Kind

func (*Float) Position ¶

func (f *Float) Position() Position

func (*Float) String ¶

func (*Float) String() string

func (*Float) ToProto ¶

func (x *Float) ToProto() *destpb.Float

type FromOffset ¶

type FromOffset int
const (
	FromOffsetUnspecified FromOffset = iota
	FromOffsetBeginning
	FromOffsetLatest
)

func FromOffsetFromProto ¶ added in v0.424.0

func FromOffsetFromProto(v destpb.FromOffset) (FromOffset, error)

func (*FromOffset) Capture ¶

func (o *FromOffset) Capture(values []string) error

func (FromOffset) String ¶

func (o FromOffset) String() string

func (FromOffset) ToProto ¶

func (x FromOffset) ToProto() destpb.FromOffset

type FullSchemaNotification ¶ added in v0.439.0

type FullSchemaNotification struct {
	Schema     *Schema      `protobuf:"1"`
	Changesets []*Changeset `protobuf:"2"`
}

func FullSchemaNotificationFromProto ¶ added in v0.439.0

func FullSchemaNotificationFromProto(v *destpb.FullSchemaNotification) (out *FullSchemaNotification, err error)

func (*FullSchemaNotification) ToProto ¶ added in v0.439.0

type GraphNode ¶ added in v0.434.0

type GraphNode struct {
	Decl Decl
	In   []RefKey
	Out  []RefKey
}

GraphNode provides inbound and outbound edges for a node.

type IngressPathComponent ¶

type IngressPathComponent interface {
	Node
	// contains filtered or unexported methods
}

func IngressPathComponentFromProto ¶ added in v0.424.0

func IngressPathComponentFromProto(v *destpb.IngressPathComponent) (IngressPathComponent, error)

type IngressPathLiteral ¶

type IngressPathLiteral struct {
	Pos Position `parser:"" protobuf:"1,optional"`

	Text string `parser:"@~(Whitespace | '/' | '{' | '}')+" protobuf:"2"`
}

func IngressPathLiteralFromProto ¶ added in v0.424.0

func IngressPathLiteralFromProto(v *destpb.IngressPathLiteral) (out *IngressPathLiteral, err error)

func (*IngressPathLiteral) Position ¶

func (l *IngressPathLiteral) Position() Position

func (*IngressPathLiteral) String ¶

func (l *IngressPathLiteral) String() string

func (*IngressPathLiteral) ToProto ¶

type IngressPathParameter ¶

type IngressPathParameter struct {
	Pos Position `parser:"" protobuf:"1,optional"`

	Name string `parser:"'{' @Ident '}'" protobuf:"2"`
}

func IngressPathParameterFromProto ¶ added in v0.424.0

func IngressPathParameterFromProto(v *destpb.IngressPathParameter) (out *IngressPathParameter, err error)

func (*IngressPathParameter) Position ¶

func (l *IngressPathParameter) Position() Position

func (*IngressPathParameter) String ¶

func (l *IngressPathParameter) String() string

func (*IngressPathParameter) ToProto ¶

type Int ¶

type Int struct {
	Pos Position `parser:"" protobuf:"1,optional"`

	Int bool `parser:"@'Int'" protobuf:"-"`
}

func IntFromProto ¶ added in v0.424.0

func IntFromProto(v *destpb.Int) (out *Int, err error)

func (*Int) Equal ¶

func (i *Int) Equal(other Type) bool

func (*Int) GetName ¶

func (*Int) GetName() string

func (*Int) Kind ¶ added in v0.477.0

func (*Int) Kind() Kind

func (*Int) Position ¶

func (i *Int) Position() Position

func (*Int) String ¶

func (*Int) String() string

func (*Int) ToProto ¶

func (x *Int) ToProto() *destpb.Int

type IntValue ¶

type IntValue struct {
	Pos Position `parser:"" protobuf:"1,optional"`

	Value int `parser:"@Number" protobuf:"2"`
}

func IntValueFromProto ¶ added in v0.424.0

func IntValueFromProto(v *destpb.IntValue) (out *IntValue, err error)

func (*IntValue) Equal ¶ added in v0.477.0

func (i *IntValue) Equal(other Value) bool

func (*IntValue) GetValue ¶

func (i *IntValue) GetValue() any

func (*IntValue) Position ¶

func (i *IntValue) Position() Position

func (*IntValue) String ¶

func (i *IntValue) String() string

func (*IntValue) ToProto ¶

func (x *IntValue) ToProto() *destpb.IntValue

type Kind ¶ added in v0.477.0

type Kind int

Kind of a Symbol in the schema.

const (
	KindData Kind = iota
	KindInt
	KindFloat
	KindString
	KindBool
	KindBytes
	KindOptional
	KindMap
	KindArray
	KindRef
	KindTime
	KindAny
	KindUnit
	KindEnum
	KindTypeAlias
)

func (Kind) String ¶ added in v0.477.0

func (k Kind) String() string

type Map ¶

type Map struct {
	Pos Position `parser:"" protobuf:"1,optional"`

	Key   Type `parser:"'{' @@" protobuf:"2"`
	Value Type `parser:"':' @@ '}'" protobuf:"3"`
}

func MapFromProto ¶ added in v0.424.0

func MapFromProto(v *destpb.Map) (out *Map, err error)

func (*Map) Equal ¶

func (m *Map) Equal(other Type) bool

func (*Map) Kind ¶ added in v0.477.0

func (*Map) Kind() Kind

func (*Map) Position ¶

func (m *Map) Position() Position

func (*Map) String ¶

func (m *Map) String() string

func (*Map) ToProto ¶

func (x *Map) ToProto() *destpb.Map

type Metadata ¶

type Metadata interface {
	Node
	// contains filtered or unexported methods
}

Metadata represents a metadata Node in the schema grammar.

func MetadataFromProto ¶ added in v0.424.0

func MetadataFromProto(v *destpb.Metadata) (Metadata, error)

type MetadataAlias ¶

type MetadataAlias struct {
	Pos Position `parser:"" protobuf:"1,optional"`

	Kind  AliasKind `parser:"'+' 'alias' @Ident" protobuf:"2"`
	Alias string    `parser:"@String" protobuf:"3"`
}

func MetadataAliasFromProto ¶ added in v0.424.0

func MetadataAliasFromProto(v *destpb.MetadataAlias) (out *MetadataAlias, err error)

func (*MetadataAlias) Position ¶

func (m *MetadataAlias) Position() Position

func (*MetadataAlias) String ¶

func (m *MetadataAlias) String() string

func (*MetadataAlias) ToProto ¶

func (x *MetadataAlias) ToProto() *destpb.MetadataAlias

type MetadataArtefact ¶

type MetadataArtefact struct {
	Pos Position `parser:"" protobuf:"1,optional"`

	Path       string        `parser:"'+' 'artefact' Whitespace @String" protobuf:"2"`
	Digest     sha256.SHA256 `parser:"@String" protobuf:"3"`
	Executable bool          `parser:"@'executable'?" protobuf:"4"`
}

func MetadataArtefactFromProto ¶ added in v0.424.0

func MetadataArtefactFromProto(v *destpb.MetadataArtefact) (out *MetadataArtefact, err error)

func (*MetadataArtefact) Position ¶

func (m *MetadataArtefact) Position() Position

func (*MetadataArtefact) String ¶

func (m *MetadataArtefact) String() string

func (*MetadataArtefact) ToProto ¶

type MetadataCalls ¶

type MetadataCalls struct {
	Pos Position `parser:"" protobuf:"1,optional"`

	Calls []*Ref `parser:"'+' 'calls' @@ (',' @@)*" protobuf:"2"`
}

MetadataCalls represents a metadata block with a list of calls.

func MetadataCallsFromProto ¶ added in v0.424.0

func MetadataCallsFromProto(v *destpb.MetadataCalls) (out *MetadataCalls, err error)

func (*MetadataCalls) Append ¶ added in v0.466.0

func (m *MetadataCalls) Append(ref *Ref)

func (*MetadataCalls) Position ¶

func (m *MetadataCalls) Position() Position

func (*MetadataCalls) String ¶

func (m *MetadataCalls) String() string

func (*MetadataCalls) ToProto ¶

func (x *MetadataCalls) ToProto() *destpb.MetadataCalls

type MetadataConfig ¶

type MetadataConfig struct {
	Pos Position `parser:"" protobuf:"1,optional"`

	Config []*Ref `parser:"'+' 'config' @@ (',' @@)*" protobuf:"2"`
}

MetadataConfig represents a metadata block with a list of config items that are used.

func MetadataConfigFromProto ¶ added in v0.424.0

func MetadataConfigFromProto(v *destpb.MetadataConfig) (out *MetadataConfig, err error)

func (*MetadataConfig) Append ¶ added in v0.466.0

func (m *MetadataConfig) Append(ref *Ref)

func (*MetadataConfig) Position ¶

func (m *MetadataConfig) Position() Position

func (*MetadataConfig) String ¶

func (m *MetadataConfig) String() string

func (*MetadataConfig) ToProto ¶

func (x *MetadataConfig) ToProto() *destpb.MetadataConfig

type MetadataCronJob ¶

type MetadataCronJob struct {
	Pos Position `parser:"" protobuf:"1,optional"`

	Cron string `parser:"'+' 'cron' Whitespace @(' ' | ~EOL)+" protobuf:"2"`
}

func MetadataCronJobFromProto ¶ added in v0.424.0

func MetadataCronJobFromProto(v *destpb.MetadataCronJob) (out *MetadataCronJob, err error)

func (*MetadataCronJob) Position ¶

func (m *MetadataCronJob) Position() Position

func (*MetadataCronJob) String ¶

func (m *MetadataCronJob) String() string

func (*MetadataCronJob) ToProto ¶

func (x *MetadataCronJob) ToProto() *destpb.MetadataCronJob

type MetadataDatabases ¶

type MetadataDatabases struct {
	Pos Position `parser:"" protobuf:"1,optional"`

	Uses []*Ref `parser:"'+' 'database' 'uses' @@ (',' @@)*" protobuf:"2"`
}

func MetadataDatabasesFromProto ¶ added in v0.424.0

func MetadataDatabasesFromProto(v *destpb.MetadataDatabases) (out *MetadataDatabases, err error)

func (*MetadataDatabases) Append ¶ added in v0.466.0

func (m *MetadataDatabases) Append(call *Ref)

func (*MetadataDatabases) Position ¶

func (m *MetadataDatabases) Position() Position

func (*MetadataDatabases) String ¶

func (m *MetadataDatabases) String() string

func (*MetadataDatabases) ToProto ¶

type MetadataEgress ¶ added in v0.477.0

type MetadataEgress struct {
	Pos     Position `parser:"" protobuf:"1,optional"`
	Targets []string `parser:"'+' 'egress' @String(',' @String)*" protobuf:"2"`
}

MetadataEgress identifies a verb that serves as a Egress boundary.

func MetadataEgressFromProto ¶ added in v0.477.0

func MetadataEgressFromProto(v *destpb.MetadataEgress) (out *MetadataEgress, err error)

func (*MetadataEgress) Position ¶ added in v0.477.0

func (m *MetadataEgress) Position() Position

func (*MetadataEgress) String ¶ added in v0.477.0

func (m *MetadataEgress) String() string

func (*MetadataEgress) ToProto ¶ added in v0.477.0

func (x *MetadataEgress) ToProto() *destpb.MetadataEgress

type MetadataEncoding ¶

type MetadataEncoding struct {
	Pos Position `parser:"" protobuf:"1,optional"`

	Type    string `parser:"'+' 'encoding' @'json'" protobuf:"2"`
	Lenient bool   `parser:"@'lenient'?" protobuf:"3"`
}

func MetadataEncodingFromProto ¶ added in v0.424.0

func MetadataEncodingFromProto(v *destpb.MetadataEncoding) (out *MetadataEncoding, err error)

func (*MetadataEncoding) Position ¶

func (m *MetadataEncoding) Position() Position

func (*MetadataEncoding) String ¶

func (m *MetadataEncoding) String() string

func (*MetadataEncoding) ToProto ¶

type MetadataFixture ¶ added in v0.468.0

type MetadataFixture struct {
	Pos    Position `parser:"" protobuf:"1,optional"`
	Manual bool     `parser:"'+' 'fixture' @'manual'?" protobuf:"2"`
}

func MetadataFixtureFromProto ¶ added in v0.468.0

func MetadataFixtureFromProto(v *destpb.MetadataFixture) (out *MetadataFixture, err error)

func (*MetadataFixture) Position ¶ added in v0.468.0

func (m *MetadataFixture) Position() Position

func (*MetadataFixture) String ¶ added in v0.468.0

func (m *MetadataFixture) String() string

func (*MetadataFixture) ToProto ¶ added in v0.468.0

func (x *MetadataFixture) ToProto() *destpb.MetadataFixture

type MetadataGenerated ¶ added in v0.462.0

type MetadataGenerated struct {
	Pos Position `parser:"'+' 'generated'" protobuf:"1,optional"`
}

MetadataGenerated designates a declaration generated by FTL.

func MetadataGeneratedFromProto ¶ added in v0.462.0

func MetadataGeneratedFromProto(v *destpb.MetadataGenerated) (out *MetadataGenerated, err error)

func (*MetadataGenerated) Position ¶ added in v0.462.0

func (m *MetadataGenerated) Position() Position

func (*MetadataGenerated) String ¶ added in v0.462.0

func (m *MetadataGenerated) String() string

func (*MetadataGenerated) ToProto ¶ added in v0.462.0

type MetadataGit ¶ added in v0.462.0

type MetadataGit struct {
	Pos        Position `parser:"" protobuf:"1,optional"`
	Repository string   `parser:"'+' 'git' Whitespace @String" protobuf:"2"`
	Commit     string   `parser:"@String" protobuf:"3"`
	Dirty      bool     `parser:"@'dirty'?" protobuf:"4"`
}

func MetadataGitFromProto ¶ added in v0.462.0

func MetadataGitFromProto(v *destpb.MetadataGit) (out *MetadataGit, err error)

func (*MetadataGit) Position ¶ added in v0.462.0

func (m *MetadataGit) Position() Position

func (*MetadataGit) String ¶ added in v0.462.0

func (m *MetadataGit) String() string

func (*MetadataGit) ToProto ¶ added in v0.462.0

func (x *MetadataGit) ToProto() *destpb.MetadataGit

type MetadataIngress ¶

type MetadataIngress struct {
	Pos Position `parser:"" protobuf:"1,optional"`

	Type   string                 `parser:"'+' 'ingress' @('http')?" protobuf:"2"`
	Method string                 `parser:"@('GET' | 'POST' | 'PUT' | 'DELETE')" protobuf:"3"`
	Path   []IngressPathComponent `parser:"('/' @@)+" protobuf:"4"`
}

func MetadataIngressFromProto ¶ added in v0.424.0

func MetadataIngressFromProto(v *destpb.MetadataIngress) (out *MetadataIngress, err error)

func (*MetadataIngress) PathString ¶

func (m *MetadataIngress) PathString() string

PathString returns the path as a string, with parameters enclosed in curly braces.

For example, /foo/{bar}

func (*MetadataIngress) Position ¶

func (m *MetadataIngress) Position() Position

func (*MetadataIngress) String ¶

func (m *MetadataIngress) String() string

func (*MetadataIngress) ToProto ¶

func (x *MetadataIngress) ToProto() *destpb.MetadataIngress

type MetadataPartitions ¶ added in v0.421.0

type MetadataPartitions struct {
	Pos Position `parser:"" protobuf:"1,optional"`

	Partitions int `parser:"'+' 'partitions' @Number" protobuf:"2"`
}

func MetadataPartitionsFromProto ¶ added in v0.424.0

func MetadataPartitionsFromProto(v *destpb.MetadataPartitions) (out *MetadataPartitions, err error)

func (*MetadataPartitions) Position ¶ added in v0.421.0

func (m *MetadataPartitions) Position() Position

func (*MetadataPartitions) String ¶ added in v0.421.0

func (m *MetadataPartitions) String() string

func (*MetadataPartitions) ToProto ¶ added in v0.421.0

type MetadataPublisher ¶

type MetadataPublisher struct {
	Pos Position `parser:"" protobuf:"1,optional"`

	Topics []*Ref `parser:"'+' 'publish' @@ (',' @@)*" protobuf:"2"`
}

func MetadataPublisherFromProto ¶ added in v0.424.0

func MetadataPublisherFromProto(v *destpb.MetadataPublisher) (out *MetadataPublisher, err error)

func (*MetadataPublisher) Append ¶ added in v0.466.0

func (m *MetadataPublisher) Append(topic *Ref)

func (*MetadataPublisher) Position ¶

func (m *MetadataPublisher) Position() Position

func (*MetadataPublisher) String ¶

func (m *MetadataPublisher) String() string

func (*MetadataPublisher) ToProto ¶

type MetadataRetry ¶

type MetadataRetry struct {
	Pos Position `parser:"" protobuf:"1,optional"`

	Count      *int   `parser:"'+' 'retry' (@Number Whitespace)?" protobuf:"2,optional"`
	MinBackoff string `parser:"@(Number (?! Whitespace) Ident)?" protobuf:"3"`
	MaxBackoff string `parser:"@(Number (?! Whitespace) Ident)?" protobuf:"4"`
	Catch      *Ref   `parser:"('catch' @@)?" protobuf:"5,optional"`
}

func MetadataRetryFromProto ¶ added in v0.424.0

func MetadataRetryFromProto(v *destpb.MetadataRetry) (out *MetadataRetry, err error)

func (*MetadataRetry) Position ¶

func (m *MetadataRetry) Position() Position

func (*MetadataRetry) RetryParams ¶

func (m *MetadataRetry) RetryParams() (RetryParams, error)

func (*MetadataRetry) String ¶

func (m *MetadataRetry) String() string

func (*MetadataRetry) ToProto ¶

func (x *MetadataRetry) ToProto() *destpb.MetadataRetry

type MetadataSQLColumn ¶ added in v0.432.0

type MetadataSQLColumn struct {
	Pos Position `parser:"" protobuf:"1,optional"`

	Table string `parser:"'+' 'sql' Whitespace 'column' Whitespace (@Ident | @String)" protobuf:"2"`
	Name  string `parser:"'.' (@Ident | @String)" protobuf:"3"`
}

MetadataSQLColumn designates a database column.

func MetadataSQLColumnFromProto ¶ added in v0.432.0

func MetadataSQLColumnFromProto(v *destpb.MetadataSQLColumn) (out *MetadataSQLColumn, err error)

func (*MetadataSQLColumn) Position ¶ added in v0.432.0

func (m *MetadataSQLColumn) Position() Position

func (*MetadataSQLColumn) String ¶ added in v0.432.0

func (m *MetadataSQLColumn) String() string

func (*MetadataSQLColumn) ToProto ¶ added in v0.432.0

type MetadataSQLMigration ¶

type MetadataSQLMigration struct {
	Pos Position `parser:"" protobuf:"1,optional"`

	Digest string `parser:"'+' 'migration' Whitespace 'sha256' ':' @SHA256" protobuf:"2"`
}

func MetadataSQLMigrationFromProto ¶ added in v0.424.0

func MetadataSQLMigrationFromProto(v *destpb.MetadataSQLMigration) (out *MetadataSQLMigration, err error)

func (*MetadataSQLMigration) Position ¶

func (m *MetadataSQLMigration) Position() Position

func (*MetadataSQLMigration) String ¶

func (m *MetadataSQLMigration) String() string

func (*MetadataSQLMigration) ToProto ¶

type MetadataSQLQuery ¶ added in v0.422.0

type MetadataSQLQuery struct {
	Pos Position `parser:"" protobuf:"1,optional"`

	Command string `parser:"'+' 'sql' Whitespace 'query' Whitespace @Ident" protobuf:"2"`
	Query   string `parser:"Whitespace @String" protobuf:"3"`
}

MetadataSQLQuery designates a query verb; a verb generated from a SQL query.

func MetadataSQLQueryFromProto ¶ added in v0.424.0

func MetadataSQLQueryFromProto(v *destpb.MetadataSQLQuery) (out *MetadataSQLQuery, err error)

func (*MetadataSQLQuery) Position ¶ added in v0.422.0

func (m *MetadataSQLQuery) Position() Position

func (*MetadataSQLQuery) String ¶ added in v0.422.0

func (m *MetadataSQLQuery) String() string

func (*MetadataSQLQuery) ToProto ¶ added in v0.422.0

type MetadataSecrets ¶

type MetadataSecrets struct {
	Pos Position `parser:"" protobuf:"1,optional"`

	Secrets []*Ref `parser:"'+' 'secrets' @@ (',' @@)*" protobuf:"2"`
}

MetadataSecrets represents a metadata block with a list of config items that are used.

func MetadataSecretsFromProto ¶ added in v0.424.0

func MetadataSecretsFromProto(v *destpb.MetadataSecrets) (out *MetadataSecrets, err error)

func (*MetadataSecrets) Append ¶ added in v0.466.0

func (m *MetadataSecrets) Append(secret *Ref)

func (*MetadataSecrets) Position ¶

func (m *MetadataSecrets) Position() Position

func (*MetadataSecrets) String ¶

func (m *MetadataSecrets) String() string

func (*MetadataSecrets) ToProto ¶

func (x *MetadataSecrets) ToProto() *destpb.MetadataSecrets

type MetadataSubscriber ¶

type MetadataSubscriber struct {
	Pos Position `parser:"" protobuf:"1,optional"`

	Topic      *Ref       `parser:"'+' 'subscribe' @@" protobuf:"2"`
	FromOffset FromOffset `parser:"'from' '=' @('beginning'|'latest')" protobuf:"3"`
	DeadLetter bool       `parser:"@'deadletter'?" protobuf:"4"`
}

func MetadataSubscriberFromProto ¶ added in v0.424.0

func MetadataSubscriberFromProto(v *destpb.MetadataSubscriber) (out *MetadataSubscriber, err error)

func (*MetadataSubscriber) Position ¶

func (m *MetadataSubscriber) Position() Position

func (*MetadataSubscriber) String ¶

func (m *MetadataSubscriber) String() string

func (*MetadataSubscriber) ToProto ¶

type MetadataTransaction ¶ added in v0.471.0

type MetadataTransaction struct {
	Pos Position `parser:"'+' 'transaction'" protobuf:"1,optional"`
}

MetadataTransaction identifies a verb that serves as a transaction boundary.

func MetadataTransactionFromProto ¶ added in v0.471.0

func MetadataTransactionFromProto(v *destpb.MetadataTransaction) (out *MetadataTransaction, err error)

func (*MetadataTransaction) Position ¶ added in v0.471.0

func (m *MetadataTransaction) Position() Position

func (*MetadataTransaction) String ¶ added in v0.471.0

func (m *MetadataTransaction) String() string

func (*MetadataTransaction) ToProto ¶ added in v0.471.0

type MetadataTypeMap ¶

type MetadataTypeMap struct {
	Pos Position `parser:"" protobuf:"1,optional"`

	Runtime    string `parser:"'+' 'typemap' @('go' | 'kotlin' | 'java')" protobuf:"2"`
	NativeName string `parser:"@String" protobuf:"3"`
}

func MetadataTypeMapFromProto ¶ added in v0.424.0

func MetadataTypeMapFromProto(v *destpb.MetadataTypeMap) (out *MetadataTypeMap, err error)

func (*MetadataTypeMap) Position ¶

func (m *MetadataTypeMap) Position() Position

func (*MetadataTypeMap) String ¶

func (m *MetadataTypeMap) String() string

func (*MetadataTypeMap) ToProto ¶

func (x *MetadataTypeMap) ToProto() *destpb.MetadataTypeMap

type Module ¶

type Module struct {
	Pos Position `parser:"" protobuf:"1,optional"`

	Comments []string   `parser:"@Comment*" protobuf:"2"`
	Builtin  bool       `parser:"@'builtin'?" protobuf:"3"`
	Name     string     `parser:"'module' @Ident '{'" protobuf:"4"`
	Metadata []Metadata `parser:"@@*" protobuf:"6"`
	Decls    []Decl     `parser:"@@* '}'" protobuf:"5"`

	Runtime *ModuleRuntime `protobuf:"31634" parser:""`
}

func Builtins ¶

func Builtins() *Module

Builtins returns a Module containing built-in types.

func ModuleFromBytes ¶

func ModuleFromBytes(b []byte) (*Module, error)

func ModuleFromProto ¶

func ModuleFromProto(v *destpb.Module) (out *Module, err error)

func ModuleFromProtoFile ¶

func ModuleFromProtoFile(filename string) (*Module, error)

ModuleFromProtoFile loads a module from the given proto-encoded file.

func ParseModule ¶

func ParseModule(filename string, r io.Reader) (*Module, error)

func ParseModuleString ¶

func ParseModuleString(filename, input string) (*Module, error)

func ValidatedModuleFromProto ¶ added in v0.424.0

func ValidatedModuleFromProto(v *schemapb.Module) (*Module, error)

func (*Module) AddData ¶

func (m *Module) AddData(data *Data) int

AddData and return its index.

If data is already in the module, the existing index is returned. If the new data is exported but the existing data is not, it sets it to being exported.

func (*Module) AddDecl ¶

func (m *Module) AddDecl(decl Decl)

AddDecl adds a single decl to the module.

It is only added if not already present or if it changes the visibility of the existing Decl.

func (*Module) AddDecls ¶

func (m *Module) AddDecls(decls []Decl)

AddDecls appends decls to the module.

Decls are only added if they are not already present in the module or if they change the visibility of an existing Decl.

func (*Module) Data ¶

func (m *Module) Data() []*Data

func (*Module) Equals ¶ added in v0.421.0

func (m *Module) Equals(other *Module) bool

func (*Module) GetByName ¶ added in v0.483.0

func (m *Module) GetByName(name string) optional.Option[Decl]

func (*Module) GetName ¶

func (m *Module) GetName() string

func (*Module) GetProvisioned ¶

func (m *Module) GetProvisioned() ResourceSet

func (*Module) GetRuntime ¶ added in v0.422.0

func (m *Module) GetRuntime() *ModuleRuntime

func (*Module) Hash ¶

func (m *Module) Hash() (sha256.SHA256, error)

Hash returns the sha256 hash of the module, including runtime.

func (*Module) Imports ¶

func (m *Module) Imports() []string

Imports returns the modules imported by this module.

func (*Module) IsExported ¶

func (m *Module) IsExported() bool

func (*Module) ModRuntime ¶ added in v0.422.0

func (m *Module) ModRuntime() *ModuleRuntime

func (*Module) Position ¶

func (m *Module) Position() Position

func (*Module) Resolve ¶

func (m *Module) Resolve(ref Ref) *ModuleDecl

Resolve returns the declaration in this module with the given name, or nil

func (*Module) ResourceID ¶

func (m *Module) ResourceID() string

func (*Module) Scan ¶

func (m *Module) Scan(src any) error

func (*Module) String ¶

func (m *Module) String() string

func (*Module) ToGeneratedModule ¶ added in v0.464.0

func (m *Module) ToGeneratedModule() *Module

ToGeneratedModule returns a new module with only the generated decls.

func (*Module) ToProto ¶

func (x *Module) ToProto() *destpb.Module

func (*Module) Validate ¶ added in v0.428.0

func (m *Module) Validate() error

Validate performs the subset of semantic validation possible on a single module.

It ignores references to other modules.

func (*Module) Value ¶

func (m *Module) Value() (driver.Value, error)

func (*Module) Verbs ¶

func (m *Module) Verbs() []*Verb

type ModuleDecl ¶

type ModuleDecl struct {
	Module optional.Option[*Module]
	Symbol Symbol
}

ModuleDecl is a declaration associated with a module.

func ResolveAs ¶

func ResolveAs[S Symbol](scopes Scopes, ref Ref) (symbol S, decl *ModuleDecl)

ResolveAs resolves a Ref to a concrete symbol and declaration.

[decl] will be non-nil if the symbol is found, regardless of its type. [symbol] will be non-nil if the symbol is of type [S].

func ResolveTypeAs ¶

func ResolveTypeAs[S Symbol](scopes Scopes, t Type) (symbol S, decl *ModuleDecl)

ResolveTypeAs resolves a Type to a concrete symbol and declaration.

type ModuleRuntime ¶

type ModuleRuntime struct {
	Base       ModuleRuntimeBase        `protobuf:"1"` // Base is always present.
	Scaling    *ModuleRuntimeScaling    `protobuf:"2,optional"`
	Deployment *ModuleRuntimeDeployment `protobuf:"3,optional"`
	Runner     *ModuleRuntimeRunner     `protobuf:"4,optional"`
}

ModuleRuntime is runtime configuration for a module that can be dynamically updated.

func ModuleRuntimeFromProto ¶

func ModuleRuntimeFromProto(v *destpb.ModuleRuntime) (out *ModuleRuntime, err error)

func (*ModuleRuntime) GetDeployment ¶ added in v0.422.0

func (m *ModuleRuntime) GetDeployment() *ModuleRuntimeDeployment

func (*ModuleRuntime) GetRunner ¶ added in v0.438.0

func (m *ModuleRuntime) GetRunner() *ModuleRuntimeRunner

func (*ModuleRuntime) GetScaling ¶ added in v0.422.0

func (m *ModuleRuntime) GetScaling() *ModuleRuntimeScaling

func (*ModuleRuntime) ModDeployment ¶ added in v0.422.0

func (m *ModuleRuntime) ModDeployment() *ModuleRuntimeDeployment

func (*ModuleRuntime) ModRunner ¶ added in v0.438.0

func (m *ModuleRuntime) ModRunner() *ModuleRuntimeRunner

func (*ModuleRuntime) ModScaling ¶ added in v0.428.0

func (m *ModuleRuntime) ModScaling() *ModuleRuntimeScaling

func (*ModuleRuntime) ToProto ¶

func (x *ModuleRuntime) ToProto() *destpb.ModuleRuntime

type ModuleRuntimeBase ¶

type ModuleRuntimeBase struct {
	CreateTime time.Time `protobuf:"1"`
	Language   string    `protobuf:"2"`
	OS         string    `protobuf:"3,optional"`
	Arch       string    `protobuf:"4,optional"`
	// Image is the name of the runner image. Defaults to "ftl0/ftl-runner".
	// Must not include a tag, as FTL's version will be used as the tag.
	Image string `protobuf:"5,optional"`
}

func ModuleRuntimeBaseFromProto ¶

func ModuleRuntimeBaseFromProto(v *destpb.ModuleRuntimeBase) (out *ModuleRuntimeBase, err error)

func (*ModuleRuntimeBase) ToProto ¶

type ModuleRuntimeDeployment ¶

type ModuleRuntimeDeployment struct {
	DeploymentKey key.Deployment             `protobuf:"2"`
	CreatedAt     time.Time                  `protobuf:"3"`
	ActivatedAt   optional.Option[time.Time] `protobuf:"4"`
	State         DeploymentState            `protobuf:"5"`
}

func ModuleRuntimeDeploymentFromProto ¶

func ModuleRuntimeDeploymentFromProto(v *destpb.ModuleRuntimeDeployment) (out *ModuleRuntimeDeployment, err error)

func (*ModuleRuntimeDeployment) GetCreatedAt ¶ added in v0.422.1

func (m *ModuleRuntimeDeployment) GetCreatedAt() time.Time

func (*ModuleRuntimeDeployment) GetDeploymentKey ¶ added in v0.422.1

func (m *ModuleRuntimeDeployment) GetDeploymentKey() key.Deployment

func (*ModuleRuntimeDeployment) ToProto ¶

type ModuleRuntimeRunner ¶ added in v0.438.0

type ModuleRuntimeRunner struct {
	// Endpoint is the endpoint of the deployed module.
	Endpoint          string `protobuf:"1"`
	RunnerNotRequired bool   `protobuf:"2"`
}

func ModuleRuntimeRunnerFromProto ¶ added in v0.438.0

func ModuleRuntimeRunnerFromProto(v *destpb.ModuleRuntimeRunner) (out *ModuleRuntimeRunner, err error)

func (*ModuleRuntimeRunner) GetEndpoint ¶ added in v0.438.0

func (m *ModuleRuntimeRunner) GetEndpoint() string

func (*ModuleRuntimeRunner) GetRunnerNotRequired ¶ added in v0.476.0

func (m *ModuleRuntimeRunner) GetRunnerNotRequired() bool

func (*ModuleRuntimeRunner) Provisioned ¶ added in v0.476.0

func (m *ModuleRuntimeRunner) Provisioned() bool

func (*ModuleRuntimeRunner) ToProto ¶ added in v0.438.0

type ModuleRuntimeScaling ¶

type ModuleRuntimeScaling struct {
	MinReplicas int32 `protobuf:"1"`
}

func ModuleRuntimeScalingFromProto ¶

func ModuleRuntimeScalingFromProto(v *destpb.ModuleRuntimeScaling) (out *ModuleRuntimeScaling, err error)

func (*ModuleRuntimeScaling) GetMinReplicas ¶ added in v0.422.0

func (m *ModuleRuntimeScaling) GetMinReplicas() int32

func (*ModuleRuntimeScaling) ToProto ¶

type Named ¶

type Named interface {
	Symbol
	GetName() string
}

A Named symbol in the grammar.

type Node ¶

type Node interface {
	String() string
	Position() Position
	// contains filtered or unexported methods
}

A Node in the schema grammar.

type Notification ¶ added in v0.439.0

type Notification interface {
	// contains filtered or unexported methods
}

func NotificationFromProto ¶ added in v0.439.0

func NotificationFromProto(v *destpb.Notification) (Notification, error)

type Optional ¶

type Optional struct {
	Pos Position `parser:"" protobuf:"1,optional"`

	Type Type `parser:"@@" protobuf:"2,optional"`
}

Optional represents a Type whose value may be optional.

func OptionalFromProto ¶ added in v0.424.0

func OptionalFromProto(v *destpb.Optional) (out *Optional, err error)

func (*Optional) Equal ¶

func (o *Optional) Equal(other Type) bool

func (*Optional) Kind ¶ added in v0.477.0

func (*Optional) Kind() Kind

func (*Optional) Position ¶

func (o *Optional) Position() Position

func (*Optional) String ¶

func (o *Optional) String() string

func (*Optional) ToProto ¶

func (x *Optional) ToProto() *destpb.Optional

type PlaintextKafkaSubscriptionConnector ¶ added in v0.461.0

type PlaintextKafkaSubscriptionConnector struct {
	KafkaBrokers []string `protobuf:"1"`
}

PlaintextKafkaSubscriptionConnector is a non TLS subscription connector to a kafka cluster.

func PlaintextKafkaSubscriptionConnectorFromProto ¶ added in v0.461.0

func PlaintextKafkaSubscriptionConnectorFromProto(v *destpb.PlaintextKafkaSubscriptionConnector) (out *PlaintextKafkaSubscriptionConnector, err error)

func (*PlaintextKafkaSubscriptionConnector) ToProto ¶ added in v0.461.0

type Position ¶

type Position struct {
	Filename string `protobuf:"1"`
	Offset   int    `parser:"" protobuf:"-"`
	Line     int    `protobuf:"2"`
	Column   int    `protobuf:"3"`
}

func PositionFromProto ¶ added in v0.424.0

func PositionFromProto(v *destpb.Position) (out *Position, err error)

func (Position) String ¶

func (p Position) String() string

func (Position) ToErrorPos ¶

func (p Position) ToErrorPos() builderrors.Position

func (Position) ToErrorPosWithEnd ¶

func (p Position) ToErrorPosWithEnd(endColumn int) builderrors.Position

func (*Position) ToProto ¶

func (x *Position) ToProto() *destpb.Position

type Provisioned ¶

type Provisioned interface {
	Node
	// Returns the resources provisioned from this schema element.
	GetProvisioned() ResourceSet
	ResourceID() string
	// contains filtered or unexported methods
}

Provisioned is a schema element that provisioner acts on to create a runtime resource.

type ProvisionedResource ¶

type ProvisionedResource struct {
	// Kind is the kind of resource provisioned.
	Kind ResourceType
	// Config is the subset of the schema element's configuration that is used to create the resource.
	// changes to this config are used to check if the resource needs to be updated.
	Config any

	// DeploymentSpecific is true if the resource is specific to a deployment, and cannot be re-used by a subsequent deployment of the same module
	DeploymentSpecific bool
}

ProvisionedResource is metadata of a resource that can be provisioned from a schema element.

One schema element can result into multiple different resources. For example, a database node can be provisioned into a physical database, and a schema migration

func (*ProvisionedResource) IsEqual ¶

func (r *ProvisionedResource) IsEqual(other *ProvisionedResource) bool

type Realm ¶ added in v0.474.0

type Realm struct {
	Pos Position `parser:"" protobuf:"1"`

	External bool      `parser:"@('external')? 'realm'" protobuf:"2"`
	Name     string    `parser:"@Ident '{'" protobuf:"3"`
	Modules  []*Module `parser:"@@* '}'" protobuf:"4"`
}

func RealmFromProto ¶ added in v0.474.0

func RealmFromProto(v *destpb.Realm) (out *Realm, err error)

func ValidateModuleInRealm ¶ added in v0.485.0

func ValidateModuleInRealm(realm *Realm, m optional.Option[*Module]) (*Realm, error)

ValidateModuleInRealm clones and normalises a realm and semantically validates a single module within it. If no module is provided, all modules in the realm are validated. m can be a new or updated module that will be added to the realm before validation.

func (*Realm) ContainsRef ¶ added in v0.474.0

func (r *Realm) ContainsRef(ref *Ref) bool

func (*Realm) Deployment ¶ added in v0.474.0

func (r *Realm) Deployment(name key.Deployment) optional.Option[*Module]

Deployment returns the named deployment if it exists.

func (*Realm) FilterByVisibility ¶ added in v0.483.0

func (r *Realm) FilterByVisibility(scope Visibility) *Realm

FilterByVisibility returns a new realm with only the elements that match the given visibility scope or above, or are referred to by such elements.

func (*Realm) Module ¶ added in v0.474.0

func (r *Realm) Module(name string) optional.Option[*Module]

Module returns the named module if it exists.

func (*Realm) ModuleDependencies ¶ added in v0.474.0

func (r *Realm) ModuleDependencies(module string) map[string]*Module

ModuleDependencies returns the modules that the given module depends on Dependency modules are the ones that are called by the given module, or that publish topics that the given module subscribes to

func (*Realm) ModuleNames ¶ added in v0.482.1

func (r *Realm) ModuleNames() []string

func (*Realm) ModulesByName ¶ added in v0.487.0

func (r *Realm) ModulesByName() map[string]*Module

func (*Realm) Position ¶ added in v0.474.0

func (r *Realm) Position() Position

func (*Realm) ResolveToType ¶ added in v0.474.0

func (r *Realm) ResolveToType(ref *Ref, out Decl) error

ResolveToType resolves a reference to a declaration of the given type.

The out parameter must be a pointer to a non-nil Decl implementation or this will panic.

data := &Data{}
err := s.ResolveToType(ref, data)

func (*Realm) ResolveWithModule ¶ added in v0.474.0

func (r *Realm) ResolveWithModule(ref *Ref) (optional.Option[Decl], optional.Option[*Module])

func (*Realm) String ¶ added in v0.474.0

func (r *Realm) String() string

func (*Realm) ToProto ¶ added in v0.474.0

func (x *Realm) ToProto() *destpb.Realm

func (*Realm) Upsert ¶ added in v0.474.0

func (r *Realm) Upsert(module *Module)

Upsert inserts or replaces a module.

func (*Realm) UpsertModule ¶ added in v0.487.0

func (r *Realm) UpsertModule(module *Module)

func (*Realm) Validate ¶ added in v0.485.0

func (r *Realm) Validate() (*Realm, error)

Validate Realm clones, normalises and semantically validates a realm.

type RealmChange ¶ added in v0.477.0

type RealmChange struct {
	Name     string `protobuf:"1"`
	External bool   `protobuf:"2"`
	// Modules is the list of modules that will be added or modified in this changeset. Initial this is the canonical state of the modules.
	// Once this changeset is committed this is no longer canonical and it kept for archival purposes.
	Modules []*Module `protobuf:"3"`
	// ToRemove is the list of deployment keys that will be removed in this changeset.
	ToRemove []string `protobuf:"4"`
	// RemovingModules is the list of modules that are being removed in this changeset.
	// Once the changeset is committed this becomes the canonical state of the removing modules
	RemovingModules []*Module `protobuf:"5"`
}

func RealmChangeFromProto ¶ added in v0.477.0

func RealmChangeFromProto(v *destpb.RealmChange) (out *RealmChange, err error)

func (*RealmChange) ToProto ¶ added in v0.477.0

func (x *RealmChange) ToProto() *destpb.RealmChange

type Redactable ¶

type Redactable interface {
	Redact()
}

type Ref ¶

type Ref struct {
	Pos Position `parser:"" protobuf:"1,optional"`

	Module string `parser:"(@Ident '.')?" protobuf:"3"`
	Name   string `parser:"@Ident" protobuf:"2"`
	// Only used for data references.
	TypeParameters []Type `parser:"[ '<' @@ (',' @@)* '>' ]" protobuf:"4"`
}

Ref is an untyped reference to a symbol.

func ParseRef ¶

func ParseRef(ref string) (*Ref, error)

func RefFromProto ¶

func RefFromProto(v *destpb.Ref) (out *Ref, err error)

func (*Ref) Equal ¶

func (r *Ref) Equal(other Type) bool

func (*Ref) Kind ¶ added in v0.477.0

func (r *Ref) Kind() Kind

func (*Ref) Position ¶

func (r *Ref) Position() Position

func (*Ref) Scan ¶

func (r *Ref) Scan(src any) error

func (*Ref) String ¶

func (r *Ref) String() string

func (*Ref) ToProto ¶

func (x *Ref) ToProto() *destpb.Ref

func (Ref) ToRefKey ¶

func (r Ref) ToRefKey() RefKey

func (Ref) Value ¶

func (r Ref) Value() (driver.Value, error)

type RefKey ¶

type RefKey struct {
	Module string `parser:"(@Ident '.')?"`
	Name   string `parser:"@Ident"`
}

RefKey is a map key for a reference.

func OutboundEdges ¶ added in v0.483.0

func OutboundEdges(n Node, ignoredRefs map[RefKey]bool) []RefKey

OutboundEdges returns all the outbound edges of a node.

func (RefKey) ModuleOnly ¶ added in v0.482.1

func (r RefKey) ModuleOnly() RefKey

func (*RefKey) Scan ¶

func (r *RefKey) Scan(src any) error

func (RefKey) String ¶

func (r RefKey) String() string

func (RefKey) ToProto ¶

func (r RefKey) ToProto() *schemapb.Ref

func (RefKey) ToRef ¶

func (r RefKey) ToRef() *Ref

func (RefKey) Value ¶

func (r RefKey) Value() (driver.Value, error)

type Resolver ¶

type Resolver interface {
	// Resolve a reference to a symbol declaration or nil.
	Resolve(ref Ref) *ModuleDecl
}

Resolver may be implemented be a node in the AST to resolve references within itself.

type ResourceSet ¶

type ResourceSet []*ProvisionedResource

func GetProvisionedResources ¶

func GetProvisionedResources(n Node) ResourceSet

func (ResourceSet) FilterByType ¶

func (s ResourceSet) FilterByType(kinds ...ResourceType) ResourceSet

func (ResourceSet) Get ¶

func (ResourceSet) IsEqual ¶

func (s ResourceSet) IsEqual(other ResourceSet) bool

type ResourceType ¶

type ResourceType string

ResourceType is a type of resource used to configure provisioners

const (
	ResourceTypeUnknown      ResourceType = "unknown"
	ResourceTypePostgres     ResourceType = "postgres"
	ResourceTypeMysql        ResourceType = "mysql"
	ResourceTypeSQLMigration ResourceType = "sql-migration"
	ResourceTypeTopic        ResourceType = "topic"
	ResourceTypeSubscription ResourceType = "subscription"
	ResourceTypeEgress       ResourceType = "egress"
	ResourceTypeRunner       ResourceType = "runner"
	ResourceTypeFixture      ResourceType = "fixture"
)

type RetryParams ¶

type RetryParams struct {
	Count      int
	MinBackoff time.Duration
	MaxBackoff time.Duration
	Catch      optional.Option[RefKey]
}

type Runtime ¶ added in v0.439.0

type Runtime interface {
	// contains filtered or unexported methods
}

func RuntimeFromProto ¶ added in v0.439.0

func RuntimeFromProto(v *destpb.Runtime) (Runtime, error)

type RuntimeElement ¶ added in v0.439.0

type RuntimeElement struct {
	Element    Runtime                 `protobuf:"1"`
	Deployment key.Deployment          `protobuf:"2"`
	Name       optional.Option[string] `protobuf:"3"`
}

func RuntimeElementFromProto ¶ added in v0.439.0

func RuntimeElementFromProto(v *destpb.RuntimeElement) (out *RuntimeElement, err error)

func (*RuntimeElement) ApplyToModule ¶ added in v0.439.0

func (x *RuntimeElement) ApplyToModule(state *Module) error

func (*RuntimeElement) ToProto ¶ added in v0.439.0

func (x *RuntimeElement) ToProto() *destpb.RuntimeElement

type Schema ¶

type Schema struct {
	Pos    Position `parser:"" protobuf:"1,optional"`
	Realms []*Realm `parser:"@@*" protobuf:"2"`
}

func FromProto ¶

func FromProto(s *schemapb.Schema) (*Schema, error)

FromProto converts a protobuf Schema to a Schema and validates it.

func MustValidate ¶

func MustValidate(schema *Schema) *Schema

MustValidate panics if a schema is invalid.

This is useful for testing.

func Parse ¶

func Parse(filename string, r io.Reader) (*Schema, error)

func ParseString ¶

func ParseString(filename, input string) (*Schema, error)

func SchemaFromProto ¶ added in v0.424.0

func SchemaFromProto(v *destpb.Schema) (out *Schema, err error)

func ValidateModuleInSchema ¶

func ValidateModuleInSchema(original *Schema, m optional.Option[*Module]) (*Schema, error)

ValidateModuleInSchema clones and normalises a schema and semantically validates a single module in it's internal realm. m can be a new or updated module that will be added to the schema before validation (in the internal realm).

func (*Schema) Deployment ¶ added in v0.448.0

func (s *Schema) Deployment(name key.Deployment) optional.Option[*Module]

func (*Schema) External ¶ added in v0.483.0

func (s *Schema) External() *Schema

External returns the subset of the schema exported by internal realms. This schema can be used as external schema in other clusters.

func (*Schema) FilterModules ¶ added in v0.482.1

func (s *Schema) FilterModules(modules []RefKey) (*Schema, []RefKey)

FilterModules returns a new schema with only the modules in the given list of references. Returns the filtered schema and any refs that were not found in the original schema.

func (*Schema) FirstInternalRealm ¶ added in v0.482.1

func (s *Schema) FirstInternalRealm() optional.Option[*Realm]

func (*Schema) Hash ¶

func (s *Schema) Hash() [sha256.Size]byte

func (*Schema) InternalModules ¶ added in v0.474.0

func (s *Schema) InternalModules() []*Module

func (*Schema) InternalRealms ¶ added in v0.474.0

func (s *Schema) InternalRealms() []*Realm

func (*Schema) Module ¶

func (s *Schema) Module(realm, name string) optional.Option[*Module]

func (*Schema) ModuleDependencies ¶ added in v0.413.1

func (s *Schema) ModuleDependencies(module string) map[string]*Module

func (*Schema) Position ¶

func (s *Schema) Position() Position

func (*Schema) Realm ¶ added in v0.487.0

func (s *Schema) Realm(name string) optional.Option[*Realm]

func (*Schema) RemoveModule ¶ added in v0.487.0

func (s *Schema) RemoveModule(realm, module string)

func (*Schema) Resolve ¶

func (s *Schema) Resolve(ref *Ref) optional.Option[Decl]

Resolve a reference to a declaration.

func (*Schema) ResolveMonomorphised ¶

func (s *Schema) ResolveMonomorphised(ref *Ref) (*Data, error)

ResolveMonomorphised resolves a reference to a monomorphised Data type. Also supports resolving the monomorphised Data type underlying a TypeAlias, where applicable.

If a Ref is not found, returns ErrNotFound.

func (*Schema) ResolveRequestResponseType ¶

func (s *Schema) ResolveRequestResponseType(ref *Ref) (Symbol, error)

ResolveRequestResponseType resolves a reference to a supported request/response type, which can be a Data or an Any, or a TypeAlias over either supported type.

func (*Schema) ResolveToType ¶

func (s *Schema) ResolveToType(ref *Ref, out Decl) error

func (*Schema) ResolveType ¶ added in v0.477.0

func (s *Schema) ResolveType(ref *Ref) (Type, error)

ResolveType resolves a Ref to a Type, or errors if the dereferenced declaration is not a Type.

If the resolved Type is generic it will be monomorphised.

func (*Schema) ResolveWithModule ¶

func (s *Schema) ResolveWithModule(ref *Ref) (optional.Option[Decl], optional.Option[*Module])

ResolveWithModule a reference to a declaration and its module.

func (*Schema) String ¶

func (s *Schema) String() string

func (*Schema) ToProto ¶

func (x *Schema) ToProto() *destpb.Schema

func (*Schema) UpdateRealms ¶ added in v0.487.0

func (s *Schema) UpdateRealms(realms []*Realm)

func (*Schema) Validate ¶ added in v0.428.0

func (s *Schema) Validate() (*Schema, error)

Validate Schema clones, normalises and semantically validates a schema.

func (*Schema) WithBuiltins ¶ added in v0.485.0

func (s *Schema) WithBuiltins() *Schema

WithBuiltins returns a new schema with the builtins module added to each internal realm.

type SchemaState ¶ added in v0.435.0

type SchemaState struct {
	Schema           *Schema                   `protobuf:"1"`
	Changesets       []*Changeset              `protobuf:"2"`
	ChangesetEvents  []*DeploymentRuntimeEvent `protobuf:"3"`
	DeploymentEvents []*DeploymentRuntimeEvent `protobuf:"4"`
}

SchemaState is the schema service state as persisted in Raft

func SchemaStateFromProto ¶ added in v0.435.0

func SchemaStateFromProto(v *destpb.SchemaState) (out *SchemaState, err error)

func (*SchemaState) ToProto ¶ added in v0.435.0

func (x *SchemaState) ToProto() *destpb.SchemaState

func (*SchemaState) Validate ¶ added in v0.487.0

func (s *SchemaState) Validate() error

type Scope ¶

type Scope map[string]ModuleDecl

Scope maps relative names to fully qualified types.

func (Scope) String ¶

func (s Scope) String() string

type Scoped ¶

type Scoped interface {
	Scope() Scope
}

Scoped is implemented by nodes that wish to introduce a new scope.

type Scopes ¶

type Scopes []Scope

Scopes to search during type resolution.

func NewScopes ¶

func NewScopes() Scopes

NewScopes constructs a new type resolution stack with builtins pre-populated.

func (*Scopes) Add ¶

func (s *Scopes) Add(owner optional.Option[*Module], name string, symbol Symbol) error

Add a declaration to the current scope.

func (Scopes) Push ¶

func (s Scopes) Push() Scopes

Push a new Scope onto the stack.

This contains references to previous Scopes so that updates are preserved.

func (Scopes) PushScope ¶

func (s Scopes) PushScope(scope Scope) Scopes

func (Scopes) Resolve ¶

func (s Scopes) Resolve(ref Ref) *ModuleDecl

Resolve a reference to a symbol declaration or nil.

func (Scopes) ResolveType ¶

func (s Scopes) ResolveType(t Type) *ModuleDecl

func (Scopes) String ¶

func (s Scopes) String() string

type Secret ¶

type Secret struct {
	Pos Position `parser:"" protobuf:"1,optional"`

	Comments []string `parser:"@Comment*" protobuf:"2"`
	Name     string   `parser:"'secret' @Ident" protobuf:"3"`
	Type     Type     `parser:"@@" protobuf:"4"`
}

func SecretFromProto ¶

func SecretFromProto(v *destpb.Secret) (out *Secret, err error)

func (*Secret) GetName ¶

func (s *Secret) GetName() string

func (*Secret) GetVisibility ¶ added in v0.480.0

func (s *Secret) GetVisibility() Visibility

func (*Secret) IsGenerated ¶ added in v0.464.0

func (s *Secret) IsGenerated() bool

func (*Secret) Position ¶

func (s *Secret) Position() Position

func (*Secret) String ¶

func (s *Secret) String() string

func (*Secret) ToProto ¶

func (x *Secret) ToProto() *destpb.Secret

func (*Secret) Validate ¶ added in v0.486.0

func (s *Secret) Validate() error

type String ¶

type String struct {
	Pos Position `parser:"" protobuf:"1,optional"`

	Str bool `parser:"@'String'" protobuf:"-"`
}

func StringFromProto ¶ added in v0.424.0

func StringFromProto(v *destpb.String) (out *String, err error)

func (*String) Equal ¶

func (s *String) Equal(other Type) bool

func (*String) GetName ¶

func (*String) GetName() string

func (*String) Kind ¶ added in v0.477.0

func (*String) Kind() Kind

func (*String) Position ¶

func (s *String) Position() Position

func (*String) String ¶

func (*String) String() string

func (*String) ToProto ¶

func (x *String) ToProto() *destpb.String

type StringValue ¶

type StringValue struct {
	Pos Position `parser:"" protobuf:"1,optional"`

	Value string `parser:"@String" protobuf:"2"`
}

func StringValueFromProto ¶ added in v0.424.0

func StringValueFromProto(v *destpb.StringValue) (out *StringValue, err error)

func (*StringValue) Equal ¶ added in v0.477.0

func (s *StringValue) Equal(other Value) bool

func (*StringValue) GetValue ¶

func (s *StringValue) GetValue() any

func (*StringValue) Position ¶

func (s *StringValue) Position() Position

func (*StringValue) String ¶

func (s *StringValue) String() string

func (*StringValue) ToProto ¶

func (x *StringValue) ToProto() *destpb.StringValue

type SubscriptionConnector ¶ added in v0.461.0

type SubscriptionConnector interface {
	// contains filtered or unexported methods
}

SubscriptionConnector is a connector to subscribe to a topic.

func SubscriptionConnectorFromProto ¶ added in v0.461.0

func SubscriptionConnectorFromProto(v *destpb.SubscriptionConnector) (SubscriptionConnector, error)

type Symbol ¶

type Symbol interface {
	Node
	// contains filtered or unexported methods
}

Symbol represents a symbol in the schema grammar.

A Symbol is a named type that can be referenced by other types. This includes user defined data types such as data structures and enums, and builtin types.

type Time ¶

type Time struct {
	Pos Position `parser:"" protobuf:"1,optional"`

	Time bool `parser:"@'Time'" protobuf:"-"`
}

func TimeFromProto ¶ added in v0.424.0

func TimeFromProto(v *destpb.Time) (out *Time, err error)

func (*Time) Equal ¶

func (t *Time) Equal(other Type) bool

func (*Time) GetName ¶

func (*Time) GetName() string

func (*Time) Kind ¶ added in v0.477.0

func (*Time) Kind() Kind

func (*Time) Position ¶

func (t *Time) Position() Position

func (*Time) String ¶

func (*Time) String() string

func (*Time) ToProto ¶

func (x *Time) ToProto() *destpb.Time

type Topic ¶

type Topic struct {
	Pos     Position      `parser:"" protobuf:"1,optional"`
	Runtime *TopicRuntime `parser:"" protobuf:"31634,optional"`

	Comments   []string   `parser:"@Comment*" protobuf:"2"`
	Visibility Visibility `parser:"@@?" protobuf:"3"`
	Name       string     `parser:"'topic' @Ident" protobuf:"4"`
	Event      Type       `parser:"@@" protobuf:"5"`
	Metadata   []Metadata `parser:"@@*" protobuf:"6"`
}

func TopicFromProto ¶

func TopicFromProto(v *destpb.Topic) (out *Topic, err error)

func (*Topic) GetName ¶

func (t *Topic) GetName() string

func (*Topic) GetProvisioned ¶

func (t *Topic) GetProvisioned() ResourceSet

func (*Topic) GetVisibility ¶ added in v0.480.0

func (t *Topic) GetVisibility() Visibility

func (*Topic) IsGenerated ¶ added in v0.464.0

func (t *Topic) IsGenerated() bool

func (*Topic) Position ¶

func (t *Topic) Position() Position

func (*Topic) ResourceID ¶

func (t *Topic) ResourceID() string

func (*Topic) String ¶

func (t *Topic) String() string

func (*Topic) ToProto ¶

func (x *Topic) ToProto() *destpb.Topic

type TopicRuntime ¶

type TopicRuntime struct {
	KafkaBrokers []string `parser:"" protobuf:"1"`
	TopicID      string   `parser:"" protobuf:"2"`
}

func TopicRuntimeFromProto ¶

func TopicRuntimeFromProto(v *destpb.TopicRuntime) (out *TopicRuntime, err error)

func (*TopicRuntime) ToProto ¶

func (x *TopicRuntime) ToProto() *destpb.TopicRuntime

type Type ¶

type Type interface {
	Node
	// Equal returns true if this type is equal to another type.
	Equal(other Type) bool
	// Kind of the Symbol.
	Kind() Kind
	// contains filtered or unexported methods
}

Type represents a Type Node in the schema grammar.

func ParseType ¶

func ParseType(filename, input string) (Type, error)

ParseType parses the string representation of a type.

func ParseTypeWithLexer ¶ added in v0.460.0

func ParseTypeWithLexer(pl *lexer.PeekingLexer) (Type, error)

func TypeFromProto ¶

func TypeFromProto(v *destpb.Type) (Type, error)

type TypeAlias ¶

type TypeAlias struct {
	Pos Position `parser:"" protobuf:"1,optional"`

	Comments   []string   `parser:"@Comment*" protobuf:"2"`
	Visibility Visibility `parser:"@@?" protobuf:"3"`
	Name       string     `parser:"'typealias' @Ident" protobuf:"4"`
	Type       Type       `parser:"@@" protobuf:"5"`
	Metadata   []Metadata `parser:"@@*" protobuf:"6"`
}

func TypeAliasFromProto ¶

func TypeAliasFromProto(v *destpb.TypeAlias) (out *TypeAlias, err error)

func (*TypeAlias) Equal ¶ added in v0.477.0

func (t *TypeAlias) Equal(other Type) bool

func (*TypeAlias) GetName ¶

func (t *TypeAlias) GetName() string

func (*TypeAlias) GetVisibility ¶ added in v0.480.0

func (t *TypeAlias) GetVisibility() Visibility

func (*TypeAlias) IsGenerated ¶ added in v0.464.0

func (t *TypeAlias) IsGenerated() bool

func (*TypeAlias) Kind ¶ added in v0.477.0

func (t *TypeAlias) Kind() Kind

func (*TypeAlias) Position ¶

func (t *TypeAlias) Position() Position

func (*TypeAlias) String ¶

func (t *TypeAlias) String() string

func (*TypeAlias) ToProto ¶

func (x *TypeAlias) ToProto() *destpb.TypeAlias

type TypeParameter ¶

type TypeParameter struct {
	Pos Position `parser:"" protobuf:"1,optional"`

	Name string `parser:"@Ident" protobuf:"2"`
}

func TypeParameterFromProto ¶ added in v0.424.0

func TypeParameterFromProto(v *destpb.TypeParameter) (out *TypeParameter, err error)

func (*TypeParameter) GetName ¶

func (t *TypeParameter) GetName() string

func (*TypeParameter) Position ¶

func (t *TypeParameter) Position() Position

func (*TypeParameter) String ¶

func (t *TypeParameter) String() string

func (*TypeParameter) ToProto ¶

func (x *TypeParameter) ToProto() *destpb.TypeParameter

type TypeValue ¶

type TypeValue struct {
	Pos Position `parser:"" protobuf:"1,optional"`

	Value Type `parser:"@@" protobuf:"2"`
}

func TypeValueFromProto ¶ added in v0.424.0

func TypeValueFromProto(v *destpb.TypeValue) (out *TypeValue, err error)

func (*TypeValue) Equal ¶ added in v0.477.0

func (t *TypeValue) Equal(other Value) bool

func (*TypeValue) GetValue ¶

func (t *TypeValue) GetValue() any

func (*TypeValue) Position ¶

func (t *TypeValue) Position() Position

func (*TypeValue) String ¶

func (t *TypeValue) String() string

func (*TypeValue) ToProto ¶

func (x *TypeValue) ToProto() *destpb.TypeValue

type Unit ¶

type Unit struct {
	Pos Position `parser:"" protobuf:"1,optional"`

	Unit bool `parser:"@'Unit'" protobuf:"-"`
}

func UnitFromProto ¶ added in v0.424.0

func UnitFromProto(v *destpb.Unit) (out *Unit, err error)

func (*Unit) Equal ¶

func (u *Unit) Equal(other Type) bool

func (*Unit) GetName ¶

func (u *Unit) GetName() string

func (*Unit) Kind ¶ added in v0.477.0

func (u *Unit) Kind() Kind

func (*Unit) Position ¶

func (u *Unit) Position() Position

func (*Unit) String ¶

func (u *Unit) String() string

func (*Unit) ToProto ¶

func (x *Unit) ToProto() *destpb.Unit

type ValidatedNode ¶ added in v0.486.0

type ValidatedNode interface {
	Node
	Validate() error
}

type Value ¶

type Value interface {
	Node
	Equal(other Value) bool
	GetValue() any
	// contains filtered or unexported methods
}

Value represents a value Node in the schema grammar.

func ValueFromProto ¶ added in v0.424.0

func ValueFromProto(v *destpb.Value) (Value, error)

type Verb ¶

type Verb struct {
	Pos Position `parser:"" protobuf:"1,optional"`

	Comments   []string   `parser:"@Comment*" protobuf:"2"`
	Visibility Visibility `parser:"@@?" protobuf:"3"`
	Name       string     `parser:"'verb' @Ident" protobuf:"4"`
	Request    Type       `parser:"'(' @@ ')'" protobuf:"5"`
	Response   Type       `parser:"@@" protobuf:"6"`
	Metadata   []Metadata `parser:"@@*" protobuf:"7"`

	Runtime *VerbRuntime `protobuf:"31634,optional" parser:""`
}

func VerbFromProto ¶

func VerbFromProto(v *destpb.Verb) (out *Verb, err error)

func (*Verb) AddCall ¶

func (v *Verb) AddCall(verb *Ref)

AddCall adds a call reference to the Verb.

func (*Verb) AddConfig ¶

func (v *Verb) AddConfig(config *Ref)

AddConfig adds a config reference to the Verb.

func (*Verb) AddDatabase ¶

func (v *Verb) AddDatabase(db *Ref)

AddDatabase adds a DB reference to the Verb.

func (*Verb) AddEgress ¶ added in v0.477.0

func (v *Verb) AddEgress(target string)

func (*Verb) AddSecret ¶

func (v *Verb) AddSecret(secret *Ref)

AddSecret adds a config reference to the Verb.

func (*Verb) AddSubscription ¶

func (v *Verb) AddSubscription(sub *MetadataSubscriber)

func (*Verb) AddTopicPublish ¶

func (v *Verb) AddTopicPublish(topic *Ref)

AddTopicPublish adds a topic that this Verb publishes to.

func (*Verb) GetMetadataCronJob ¶

func (v *Verb) GetMetadataCronJob() optional.Option[*MetadataCronJob]

func (*Verb) GetMetadataEgress ¶ added in v0.477.0

func (v *Verb) GetMetadataEgress() optional.Option[*MetadataEgress]

func (*Verb) GetMetadataIngress ¶

func (v *Verb) GetMetadataIngress() optional.Option[*MetadataIngress]

func (*Verb) GetName ¶

func (v *Verb) GetName() string

func (*Verb) GetProvisioned ¶

func (v *Verb) GetProvisioned() ResourceSet

func (*Verb) GetQuery ¶ added in v0.431.0

func (v *Verb) GetQuery() (*MetadataSQLQuery, bool)

GetQuery returns the query metadata for the Verb if it exists. If present, the Verb was generated from SQL.

func (*Verb) GetVisibility ¶ added in v0.480.0

func (v *Verb) GetVisibility() Visibility

func (*Verb) IsGenerated ¶ added in v0.426.0

func (v *Verb) IsGenerated() bool

func (*Verb) IsQuery ¶ added in v0.471.0

func (v *Verb) IsQuery() bool

func (*Verb) IsTransaction ¶ added in v0.471.0

func (v *Verb) IsTransaction() bool

func (*Verb) Kind ¶

func (v *Verb) Kind() VerbKind

Kind returns the kind of Verb this is.

func (*Verb) Position ¶

func (v *Verb) Position() Position

func (*Verb) ResolveCalls ¶ added in v0.471.0

func (v *Verb) ResolveCalls(resolver DeclResolver, module string) sets.Set[RefKey]

ResolveCalls resolves all verbs called by a verb, explicitly or implicitly.

func (*Verb) ResolveDatabaseUses ¶ added in v0.471.0

func (v *Verb) ResolveDatabaseUses(resolver DeclResolver, module string) sets.Set[RefKey]

ResolveDatabaseUses resolves all datasources accessed by a verb, explicitly or implicitly.

func (*Verb) ResourceID ¶

func (v *Verb) ResourceID() string

func (*Verb) SortMetadata ¶

func (v *Verb) SortMetadata()

func (*Verb) String ¶

func (v *Verb) String() string

func (*Verb) ToProto ¶

func (x *Verb) ToProto() *destpb.Verb

type VerbKind ¶

type VerbKind string

VerbKind is the kind of Verb: verb, sink, source or empty.

const (
	// VerbKindVerb is a normal verb taking an input and an output of any non-unit type.
	VerbKindVerb VerbKind = "verb"
	// VerbKindSink is a verb that takes an input and returns unit.
	VerbKindSink VerbKind = "sink"
	// VerbKindSource is a verb that returns an output and takes unit.
	VerbKindSource VerbKind = "source"
	// VerbKindEmpty is a verb that takes unit and returns unit.
	VerbKindEmpty VerbKind = "empty"
)

type VerbRuntime ¶

type VerbRuntime struct {
	SubscriptionConnector SubscriptionConnector `protobuf:"1,optional"`
	EgressRuntime         *EgressRuntime        `protobuf:"2,optional"`
}

func VerbRuntimeFromProto ¶ added in v0.424.0

func VerbRuntimeFromProto(v *destpb.VerbRuntime) (out *VerbRuntime, err error)

func (*VerbRuntime) ToProto ¶

func (x *VerbRuntime) ToProto() *destpb.VerbRuntime

type Visibility ¶ added in v0.480.0

type Visibility int

buf:lint:ignore ENUM_ZERO_VALUE_SUFFIX

const (
	// VisibilityScopeNone is visible only within the same module
	VisibilityScopeNone Visibility = iota
	// VisibilityScopeModule is visible in all modules in the same realm
	VisibilityScopeModule
	// VisibilityScopeRealm is visible in external realms
	VisibilityScopeRealm
)

func VisibilityFromProto ¶ added in v0.480.0

func VisibilityFromProto(v destpb.Visibility) (Visibility, error)

func (Visibility) Exported ¶ added in v0.480.0

func (v Visibility) Exported() bool

func (*Visibility) Parse ¶ added in v0.480.0

func (v *Visibility) Parse(lex *lexer.PeekingLexer) error

func (Visibility) String ¶ added in v0.480.0

func (v Visibility) String() string

func (Visibility) ToProto ¶ added in v0.480.0

func (x Visibility) ToProto() destpb.Visibility

Directories ¶

Path Synopsis

Jump to

Keyboard shortcuts

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