schema

package
v0.162.0 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2024 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

View Source
const BuiltinsSource = `` /* 539-byte string literal not displayed */

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

Variables

View Source
var (
	Lexer = lexer.MustSimple([]lexer.SimpleRule{
		{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 added in v0.139.2

func AliasKindStrings() []string

AliasKindStrings returns a slice of all String values of the enum

func DataToJSONSchema added in v0.1.1

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

DataToJSONSchema converts the schema for a Data object to a JSON Schema.

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

func ModuleToBytes added in v0.111.2

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 ProtobufSchema

func ProtobufSchema() string

ProtobufSchema returns a string containing the equivalent protobuf schema for the FTL schema.

func TypeName added in v0.98.11

func TypeName(v any) string

func ValidateModule

func ValidateModule(module *Module) error

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

It ignores references to other modules.

func ValidateName added in v0.99.0

func ValidateName(name string) bool

ValidateName validates an FTL name.

func Visit

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

Visit all nodes in the schema.

func VisitExcludingMetadataChildren added in v0.153.2

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.

Types

type AliasKind added in v0.139.2

type AliasKind int

AliasKind is the kind of alias.

const (
	AliasKindJSON AliasKind = iota
)

func AliasKindString added in v0.139.2

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 added in v0.139.2

func AliasKindValues() []AliasKind

AliasKindValues returns all values of the enum

func (AliasKind) IsAAliasKind added in v0.139.2

func (i AliasKind) IsAAliasKind() bool

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

func (AliasKind) MarshalJSON added in v0.139.2

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

MarshalJSON implements the json.Marshaler interface for AliasKind

func (AliasKind) MarshalText added in v0.139.2

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

MarshalText implements the encoding.TextMarshaler interface for AliasKind

func (AliasKind) String added in v0.139.2

func (i AliasKind) String() string

func (*AliasKind) UnmarshalJSON added in v0.139.2

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

UnmarshalJSON implements the json.Unmarshaler interface for AliasKind

func (*AliasKind) UnmarshalText added in v0.139.2

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

UnmarshalText implements the encoding.TextUnmarshaler interface for AliasKind

type Any added in v0.100.0

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

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

func (*Any) GetName added in v0.140.0

func (*Any) GetName() string

func (*Any) Position added in v0.100.0

func (a *Any) Position() Position

func (*Any) String added in v0.100.0

func (*Any) String() string

func (*Any) ToProto added in v0.100.0

func (a *Any) ToProto() proto.Message

type Array

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

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

func (*Array) Position added in v0.100.0

func (a *Array) Position() Position

func (*Array) String

func (a *Array) String() string

func (*Array) ToProto

func (a *Array) ToProto() proto.Message

type Bool

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

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

func (*Bool) GetName added in v0.140.0

func (*Bool) GetName() string

func (*Bool) Position added in v0.100.0

func (b *Bool) Position() Position

func (*Bool) String

func (*Bool) String() string

func (*Bool) ToProto

func (b *Bool) ToProto() proto.Message

type Bytes added in v0.88.0

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

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

func (*Bytes) GetName added in v0.140.0

func (*Bytes) GetName() string

func (*Bytes) Position added in v0.100.0

func (b *Bytes) Position() Position

func (*Bytes) String added in v0.88.0

func (*Bytes) String() string

func (*Bytes) ToProto added in v0.88.0

func (b *Bytes) ToProto() proto.Message

type Config added in v0.146.0

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

	Name string `parser:"'config' @Ident" protobuf:"2"`
	Type Type   `parser:"@@" protobuf:"3"`
}

func ConfigFromProto added in v0.146.3

func ConfigFromProto(p *schemapb.Config) *Config

func (*Config) GetName added in v0.146.0

func (s *Config) GetName() string

func (*Config) Position added in v0.146.0

func (s *Config) Position() Position

func (*Config) String added in v0.146.0

func (s *Config) String() string

func (*Config) ToProto added in v0.146.0

func (s *Config) ToProto() protoreflect.ProtoMessage

type Data

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

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

A Data structure.

func DataFromProto added in v0.136.0

func DataFromProto(s *schemapb.Data) *Data

func (*Data) FieldByName added in v0.122.0

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

func (*Data) GetName added in v0.140.0

func (d *Data) GetName() string

func (*Data) Monomorphise added in v0.104.0

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 added in v0.100.0

func (d *Data) Position() Position

func (*Data) Scope added in v0.101.0

func (d *Data) Scope() Scope

func (*Data) String

func (d *Data) String() string

func (*Data) ToProto

func (d *Data) ToProto() proto.Message

type Database added in v0.95.0

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

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

func DatabaseFromProto added in v0.136.0

func DatabaseFromProto(s *schemapb.Database) *Database

func (*Database) GetName added in v0.140.0

func (d *Database) GetName() string

func (*Database) Position added in v0.100.0

func (d *Database) Position() Position

func (*Database) String added in v0.95.0

func (d *Database) String() string

func (*Database) ToProto added in v0.95.0

func (d *Database) ToProto() proto.Message

type Decl

type Decl interface {
	Symbol
	GetName() string
	// contains filtered or unexported methods
}

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

type Enum added in v0.136.0

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

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

func EnumFromProto added in v0.136.0

func EnumFromProto(s *schemapb.Enum) *Enum

func (*Enum) GetName added in v0.140.0

func (e *Enum) GetName() string

func (*Enum) Position added in v0.136.0

func (e *Enum) Position() Position

func (*Enum) String added in v0.136.0

func (e *Enum) String() string

func (*Enum) ToProto added in v0.136.0

func (e *Enum) ToProto() proto.Message

type EnumVariant added in v0.136.0

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

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

func (*EnumVariant) Position added in v0.136.0

func (e *EnumVariant) Position() Position

func (*EnumVariant) String added in v0.136.0

func (e *EnumVariant) String() string

func (*EnumVariant) ToProto added in v0.136.0

func (e *EnumVariant) ToProto() proto.Message

type Error added in v0.160.0

type Error struct {
	Msg string   `json:"msg" protobuf:"1"`
	Pos Position `json:"pos" protobuf:"2"`
	Err error    `protobuf:"-"` // Wrapped error, if any
}

func Errorf added in v0.160.0

func Errorf(pos Position, format string, args ...any) Error

func Wrapf added in v0.160.0

func Wrapf(pos Position, err error, format string, args ...any) Error

func (Error) Error added in v0.160.0

func (e Error) Error() string

func (Error) Unwrap added in v0.160.0

func (e Error) Unwrap() error

type ErrorList added in v0.162.0

type ErrorList struct {
	Errors []Error `json:"errors" protobuf:"1"`
}

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 (*Field) Alias added in v0.108.0

func (f *Field) Alias(kind AliasKind) string

Alias returns the alias for the given kind, or "" if not found.

func (*Field) Position added in v0.100.0

func (f *Field) Position() Position

func (*Field) String

func (f *Field) String() string

func (*Field) ToProto

func (f *Field) ToProto() proto.Message

type Float

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

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

func (*Float) GetName added in v0.140.0

func (*Float) GetName() string

func (*Float) Position added in v0.100.0

func (f *Float) Position() Position

func (*Float) String

func (*Float) String() string

func (*Float) ToProto

func (f *Float) ToProto() proto.Message

type IngressPathComponent added in v0.85.5

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

type IngressPathLiteral added in v0.85.5

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

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

func (*IngressPathLiteral) Position added in v0.100.0

func (l *IngressPathLiteral) Position() Position

func (*IngressPathLiteral) String added in v0.85.5

func (l *IngressPathLiteral) String() string

func (*IngressPathLiteral) ToProto added in v0.85.5

func (l *IngressPathLiteral) ToProto() proto.Message

type IngressPathParameter added in v0.85.5

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

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

func (*IngressPathParameter) Position added in v0.100.0

func (l *IngressPathParameter) Position() Position

func (*IngressPathParameter) String added in v0.85.5

func (l *IngressPathParameter) String() string

func (*IngressPathParameter) ToProto added in v0.85.5

func (l *IngressPathParameter) ToProto() proto.Message

type Int

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

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

func (*Int) GetName added in v0.140.0

func (*Int) GetName() string

func (*Int) Position added in v0.100.0

func (i *Int) Position() Position

func (*Int) String

func (*Int) String() string

func (*Int) ToProto

func (i *Int) ToProto() proto.Message

type IntValue added in v0.136.0

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

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

func (*IntValue) GetValue added in v0.153.0

func (i *IntValue) GetValue() any

func (*IntValue) Position added in v0.136.0

func (i *IntValue) Position() Position

func (*IntValue) String added in v0.136.0

func (i *IntValue) String() string

func (*IntValue) ToProto added in v0.136.0

func (i *IntValue) ToProto() proto.Message

type Map

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

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

func (*Map) Position added in v0.100.0

func (m *Map) Position() Position

func (*Map) String

func (m *Map) String() string

func (*Map) ToProto

func (m *Map) ToProto() proto.Message

type Metadata

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

Metadata represents a metadata Node in the schema grammar.

type MetadataAlias added in v0.139.2

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

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

func (*MetadataAlias) Position added in v0.139.2

func (m *MetadataAlias) Position() Position

func (*MetadataAlias) String added in v0.139.2

func (m *MetadataAlias) String() string

func (*MetadataAlias) ToProto added in v0.139.2

type MetadataCalls

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

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

func (*MetadataCalls) Position added in v0.100.0

func (m *MetadataCalls) Position() Position

func (*MetadataCalls) String

func (m *MetadataCalls) String() string

func (*MetadataCalls) ToProto

func (m *MetadataCalls) ToProto() proto.Message

type MetadataDatabases added in v0.95.0

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

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

func (*MetadataDatabases) Position added in v0.100.0

func (m *MetadataDatabases) Position() Position

func (*MetadataDatabases) String added in v0.95.0

func (m *MetadataDatabases) String() string

func (*MetadataDatabases) ToProto added in v0.95.0

func (m *MetadataDatabases) ToProto() proto.Message

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 (*MetadataIngress) Position added in v0.100.0

func (m *MetadataIngress) Position() Position

func (*MetadataIngress) String

func (m *MetadataIngress) String() string

func (*MetadataIngress) ToProto

func (m *MetadataIngress) ToProto() proto.Message

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"`
	Decls    []Decl   `parser:"@@* '}'" protobuf:"5"`
}

func Builtins added in v0.89.0

func Builtins() *Module

Builtins returns a Module containing built-in types.

func ModuleFromBytes

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

func ModuleFromProto

func ModuleFromProto(s *schemapb.Module) (*Module, error)

ModuleFromProto converts a protobuf Module to a Module and validates it.

func ModuleFromProtoFile added in v0.134.1

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 (*Module) AddData

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

AddData and return its index.

func (*Module) Data

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

func (*Module) GetName added in v0.140.0

func (m *Module) GetName() string

func (*Module) Imports added in v0.61.0

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

Imports returns the modules imported by this module.

func (*Module) Position added in v0.100.0

func (m *Module) Position() Position

func (*Module) Resolve added in v0.100.0

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

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

func (*Module) Scan added in v0.113.1

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

func (*Module) String

func (m *Module) String() string

func (*Module) ToProto

func (m *Module) ToProto() proto.Message

func (*Module) Value added in v0.113.1

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

func (*Module) Verbs

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

type ModuleDecl added in v0.100.0

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

ModuleDecl is a declaration associated with a module.

func ResolveAs added in v0.157.0

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

ResolveAs resolves a Ref to a concrete symbol and declaration.

func ResolveTypeAs added in v0.157.0

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

ResolveTypeAs resolves a Type to a concrete symbol and declaration.

type Named added in v0.157.0

type Named interface {
	Symbol
	GetName() string
}

A Named symbol in the grammar.

type Node

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

A Node in the schema grammar.

type Optional added in v0.78.0

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 (*Optional) Position added in v0.100.0

func (o *Optional) Position() Position

func (*Optional) String added in v0.78.0

func (o *Optional) String() string

func (*Optional) ToProto added in v0.78.0

func (o *Optional) ToProto() proto.Message

type Position

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

func (Position) String

func (p Position) String() string

func (Position) ToProto

func (p Position) ToProto() proto.Message

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 added in v0.149.0

func RefFromProto(s *schemapb.Ref) *Ref

func (*Ref) Position added in v0.100.0

func (r *Ref) Position() Position

func (*Ref) String

func (r *Ref) String() string

func (*Ref) ToProto added in v0.149.0

func (r *Ref) ToProto() proto.Message

func (Ref) ToRefKey added in v0.149.0

func (r Ref) ToRefKey() RefKey

type RefKey added in v0.149.0

type RefKey struct {
	Module string
	Name   string
}

RefKey is a map key for a reference.

type Resolver added in v0.100.0

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 Schema

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

	Modules []*Module `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 added in v0.89.0

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 Validate

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

Validate clones, normalises and semantically valies a schema.

func (*Schema) Hash

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

func (*Schema) Module added in v0.89.0

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

Module returns the named module if it exists.

func (*Schema) Position added in v0.100.0

func (s *Schema) Position() Position

func (*Schema) ResolveRef added in v0.149.0

func (s *Schema) ResolveRef(ref *Ref) Decl

func (*Schema) ResolveRefMonomorphised added in v0.149.0

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

func (*Schema) ResolveRefToType added in v0.149.0

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

func (*Schema) String

func (s *Schema) String() string

func (*Schema) ToProto

func (s *Schema) ToProto() proto.Message

func (*Schema) Upsert

func (s *Schema) Upsert(module *Module)

Upsert inserts or replaces a module.

type Scope added in v0.100.0

type Scope map[string]ModuleDecl

Scope maps relative names to fully qualified types.

func (Scope) String added in v0.100.0

func (s Scope) String() string

type Scoped added in v0.101.0

type Scoped interface {
	Scope() Scope
}

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

type Scopes added in v0.100.0

type Scopes []Scope

Scopes to search during type resolution.

func NewScopes added in v0.100.0

func NewScopes() Scopes

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

func (*Scopes) Add added in v0.100.0

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

Add a declaration to the current scope.

func (Scopes) Push added in v0.100.0

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 added in v0.101.0

func (s Scopes) PushScope(scope Scope) Scopes

func (Scopes) Resolve added in v0.100.0

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

Resolve a reference to a symbol declaration or nil.

func (Scopes) ResolveType added in v0.157.0

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

func (Scopes) String added in v0.100.0

func (s Scopes) String() string

type Secret added in v0.146.0

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

	Name string `parser:"'secret' @Ident" protobuf:"2"`
	Type Type   `parser:"@@" protobuf:"3"`
}

func SecretFromProto added in v0.146.3

func SecretFromProto(p *schemapb.Secret) *Secret

func (*Secret) GetName added in v0.146.0

func (s *Secret) GetName() string

func (*Secret) Position added in v0.146.0

func (s *Secret) Position() Position

func (*Secret) String added in v0.146.0

func (s *Secret) String() string

func (*Secret) ToProto added in v0.146.0

func (s *Secret) ToProto() protoreflect.ProtoMessage

type String

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

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

func (*String) GetName added in v0.140.0

func (*String) GetName() string

func (*String) Position added in v0.100.0

func (s *String) Position() Position

func (*String) String

func (*String) String() string

func (*String) ToProto

func (s *String) ToProto() proto.Message

type StringValue added in v0.136.0

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

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

func (*StringValue) GetValue added in v0.153.0

func (s *StringValue) GetValue() any

func (*StringValue) Position added in v0.136.0

func (s *StringValue) Position() Position

func (*StringValue) String added in v0.136.0

func (s *StringValue) String() string

func (*StringValue) ToProto added in v0.136.0

func (s *StringValue) ToProto() proto.Message

type Symbol added in v0.149.2

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 (*Time) GetName added in v0.140.0

func (*Time) GetName() string

func (*Time) Position added in v0.100.0

func (t *Time) Position() Position

func (*Time) String

func (*Time) String() string

func (*Time) ToProto

func (t *Time) ToProto() proto.Message

type Type

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

Type represents a Type Node in the schema grammar.

type TypeParameter added in v0.101.0

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

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

func (*TypeParameter) GetName added in v0.140.0

func (t *TypeParameter) GetName() string

func (*TypeParameter) Position added in v0.101.0

func (t *TypeParameter) Position() Position

func (*TypeParameter) String added in v0.101.0

func (t *TypeParameter) String() string

func (*TypeParameter) ToProto added in v0.101.0

type Unit added in v0.94.0

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

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

func (*Unit) GetName added in v0.140.0

func (u *Unit) GetName() string

func (*Unit) Position added in v0.100.0

func (u *Unit) Position() Position

func (*Unit) String added in v0.94.0

func (u *Unit) String() string

func (*Unit) ToProto added in v0.94.0

func (u *Unit) ToProto() protoreflect.ProtoMessage

type Value added in v0.136.0

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

Value represents a value Node in the schema grammar.

type Verb

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

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

func VerbFromProto added in v0.136.0

func VerbFromProto(s *schemapb.Verb) *Verb

func (*Verb) AddCall

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

AddCall adds a call reference to the Verb.

func (*Verb) GetMetadataIngress added in v0.91.0

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

func (*Verb) GetName added in v0.140.0

func (v *Verb) GetName() string

func (*Verb) Position added in v0.100.0

func (v *Verb) Position() Position

func (*Verb) String

func (v *Verb) String() string

func (*Verb) ToProto

func (v *Verb) ToProto() proto.Message

Directories

Path Synopsis
Package strcase provides programming case conversion functions for strings.
Package strcase provides programming case conversion functions for strings.

Jump to

Keyboard shortcuts

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