Documentation ¶
Index ¶
- Variables
- func Walk(decls []*Decl, node any, visitor func(node any) error) error
- type Builtin
- type ConfigValue
- func (*ConfigValue) Descriptor() ([]byte, []int)deprecated
- func (x *ConfigValue) GetElem() *Type
- func (x *ConfigValue) GetIsValuesList() bool
- func (*ConfigValue) ProtoMessage()
- func (x *ConfigValue) ProtoReflect() protoreflect.Message
- func (x *ConfigValue) Reset()
- func (x *ConfigValue) String() string
- type Decl
- func (*Decl) Descriptor() ([]byte, []int)deprecated
- func (x *Decl) GetDoc() string
- func (x *Decl) GetId() uint32
- func (x *Decl) GetLoc() *Loc
- func (x *Decl) GetName() string
- func (x *Decl) GetType() *Type
- func (x *Decl) GetTypeParams() []*TypeParameter
- func (*Decl) ProtoMessage()
- func (x *Decl) ProtoReflect() protoreflect.Message
- func (x *Decl) Reset()
- func (x *Decl) String() string
- type Field
- func (*Field) Descriptor() ([]byte, []int)deprecated
- func (x *Field) GetDoc() string
- func (x *Field) GetJsonName() string
- func (x *Field) GetName() string
- func (x *Field) GetOptional() bool
- func (x *Field) GetQueryStringName() string
- func (x *Field) GetRawTag() string
- func (x *Field) GetTags() []*Tag
- func (x *Field) GetTyp() *Type
- func (*Field) ProtoMessage()
- func (x *Field) ProtoReflect() protoreflect.Message
- func (x *Field) Reset()
- func (x *Field) String() string
- type List
- type Loc
- func (*Loc) Descriptor() ([]byte, []int)deprecated
- func (x *Loc) GetEndPos() int32
- func (x *Loc) GetFilename() string
- func (x *Loc) GetPkgName() string
- func (x *Loc) GetPkgPath() string
- func (x *Loc) GetSrcColEnd() int32
- func (x *Loc) GetSrcColStart() int32
- func (x *Loc) GetSrcLineEnd() int32
- func (x *Loc) GetSrcLineStart() int32
- func (x *Loc) GetStartPos() int32
- func (*Loc) ProtoMessage()
- func (x *Loc) ProtoReflect() protoreflect.Message
- func (x *Loc) Reset()
- func (x *Loc) String() string
- type Map
- type Named
- type Pointer
- type Struct
- type Tag
- type Type
- func (*Type) Descriptor() ([]byte, []int)deprecated
- func (x *Type) GetBuiltin() Builtin
- func (x *Type) GetConfig() *ConfigValue
- func (x *Type) GetList() *List
- func (x *Type) GetMap() *Map
- func (x *Type) GetNamed() *Named
- func (x *Type) GetPointer() *Pointer
- func (x *Type) GetStruct() *Struct
- func (m *Type) GetTyp() isType_Typ
- func (x *Type) GetTypeParameter() *TypeParameterRef
- func (*Type) ProtoMessage()
- func (x *Type) ProtoReflect() protoreflect.Message
- func (x *Type) Reset()
- func (x *Type) String() string
- type TypeParameter
- type TypeParameterRef
- func (*TypeParameterRef) Descriptor() ([]byte, []int)deprecated
- func (x *TypeParameterRef) GetDeclId() uint32
- func (x *TypeParameterRef) GetParamIdx() uint32
- func (*TypeParameterRef) ProtoMessage()
- func (x *TypeParameterRef) ProtoReflect() protoreflect.Message
- func (x *TypeParameterRef) Reset()
- func (x *TypeParameterRef) String() string
- type Type_Builtin
- type Type_Config
- type Type_List
- type Type_Map
- type Type_Named
- type Type_Pointer
- type Type_Struct
- type Type_TypeParameter
Constants ¶
This section is empty.
Variables ¶
var ( Builtin_name = map[int32]string{ 0: "ANY", 1: "BOOL", 2: "INT8", 3: "INT16", 4: "INT32", 5: "INT64", 6: "UINT8", 7: "UINT16", 8: "UINT32", 9: "UINT64", 10: "FLOAT32", 11: "FLOAT64", 12: "STRING", 13: "BYTES", 14: "TIME", 15: "UUID", 16: "JSON", 17: "USER_ID", 18: "INT", 19: "UINT", } Builtin_value = map[string]int32{ "ANY": 0, "BOOL": 1, "INT8": 2, "INT16": 3, "INT32": 4, "INT64": 5, "UINT8": 6, "UINT16": 7, "UINT32": 8, "UINT64": 9, "FLOAT32": 10, "FLOAT64": 11, "STRING": 12, "BYTES": 13, "TIME": 14, "UUID": 15, "JSON": 16, "USER_ID": 17, "INT": 18, "UINT": 19, } )
Enum value maps for Builtin.
var File_encore_parser_schema_v1_schema_proto protoreflect.FileDescriptor
Functions ¶
Types ¶
type Builtin ¶
type Builtin int32
Builtin represents a type which Encore (and Go) have inbuilt support for and so can be represented by Encore's tooling directly, rather than needing to understand the full implementation details of how the type is structured.
const ( // Inbuilt Go Types Builtin_ANY Builtin = 0 Builtin_BOOL Builtin = 1 Builtin_INT8 Builtin = 2 Builtin_INT16 Builtin = 3 Builtin_INT32 Builtin = 4 Builtin_INT64 Builtin = 5 Builtin_UINT8 Builtin = 6 Builtin_UINT16 Builtin = 7 Builtin_UINT32 Builtin = 8 Builtin_UINT64 Builtin = 9 Builtin_FLOAT32 Builtin = 10 Builtin_FLOAT64 Builtin = 11 Builtin_STRING Builtin = 12 Builtin_BYTES Builtin = 13 // Additional Encore Types Builtin_TIME Builtin = 14 Builtin_UUID Builtin = 15 Builtin_JSON Builtin = 16 Builtin_USER_ID Builtin = 17 Builtin_INT Builtin = 18 Builtin_UINT Builtin = 19 )
func (Builtin) Descriptor ¶
func (Builtin) Descriptor() protoreflect.EnumDescriptor
func (Builtin) EnumDescriptor
deprecated
func (Builtin) Number ¶
func (x Builtin) Number() protoreflect.EnumNumber
func (Builtin) Type ¶
func (Builtin) Type() protoreflect.EnumType
type ConfigValue ¶ added in v1.8.0
type ConfigValue struct { Elem *Type `protobuf:"bytes,1,opt,name=elem,proto3" json:"elem,omitempty"` // The type of the config value IsValuesList bool `protobuf:"varint,2,opt,name=IsValuesList,proto3" json:"IsValuesList,omitempty"` // Does this config value represent the type to `config.Values[T]`. If false it represents `config.Value[T]` // contains filtered or unexported fields }
ConfigValue represents a config value wrapper.
func (*ConfigValue) Descriptor
deprecated
added in
v1.8.0
func (*ConfigValue) Descriptor() ([]byte, []int)
Deprecated: Use ConfigValue.ProtoReflect.Descriptor instead.
func (*ConfigValue) GetElem ¶ added in v1.8.0
func (x *ConfigValue) GetElem() *Type
func (*ConfigValue) GetIsValuesList ¶ added in v1.8.0
func (x *ConfigValue) GetIsValuesList() bool
func (*ConfigValue) ProtoMessage ¶ added in v1.8.0
func (*ConfigValue) ProtoMessage()
func (*ConfigValue) ProtoReflect ¶ added in v1.8.0
func (x *ConfigValue) ProtoReflect() protoreflect.Message
func (*ConfigValue) Reset ¶ added in v1.8.0
func (x *ConfigValue) Reset()
func (*ConfigValue) String ¶ added in v1.8.0
func (x *ConfigValue) String() string
type Decl ¶
type Decl struct { Id uint32 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` // A internal ID which we can refer to this declaration by Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` // The name of the type as assigned in the code Type *Type `protobuf:"bytes,3,opt,name=type,proto3" json:"type,omitempty"` // The underlying type of this declaration TypeParams []*TypeParameter `protobuf:"bytes,6,rep,name=type_params,json=typeParams,proto3" json:"type_params,omitempty"` // Any type parameters on this declaration (note; instantiated types used within this declaration would not be captured here) Doc string `protobuf:"bytes,4,opt,name=doc,proto3" json:"doc,omitempty"` // The comment block on the type Loc *Loc `protobuf:"bytes,5,opt,name=loc,proto3" json:"loc,omitempty"` // The location of the declaration within the project // contains filtered or unexported fields }
Decl represents the declaration of a type within the Go code which is either concrete or _parameterized_. The type is concrete when there are zero type parameters assigned.
For example the Go Code: ``` // Set[A] represents our set type type Set[A any] = map[A]struct{} ```
Would become: ```
_ = &Decl{ id: 1, name: "Set", type: &Type{ typ_map: &Map{ key: &Type { typ_type_parameter: ... reference to "A" type parameter below ... }, value: &Type { typ_struct: ... empty struct type ... }, }, }, typeParameters: []*TypeParameter{ { name: "A" } }, doc: "Set[A] represents our set type", loc: &Loc { ... }, }
```
func (*Decl) Descriptor
deprecated
func (*Decl) GetTypeParams ¶ added in v0.18.0
func (x *Decl) GetTypeParams() []*TypeParameter
func (*Decl) ProtoMessage ¶
func (*Decl) ProtoMessage()
func (*Decl) ProtoReflect ¶
func (x *Decl) ProtoReflect() protoreflect.Message
type Field ¶
type Field struct { Typ *Type `protobuf:"bytes,1,opt,name=typ,proto3" json:"typ,omitempty"` // The type of the field Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` // The name of the field Doc string `protobuf:"bytes,3,opt,name=doc,proto3" json:"doc,omitempty"` // The comment for the field JsonName string `protobuf:"bytes,4,opt,name=json_name,json=jsonName,proto3" json:"json_name,omitempty"` // The optional json name if it's different from the field name. (The value "-" indicates to omit the field.) Optional bool `protobuf:"varint,5,opt,name=optional,proto3" json:"optional,omitempty"` // Whether the field is optional. QueryStringName string `protobuf:"bytes,6,opt,name=query_string_name,json=queryStringName,proto3" json:"query_string_name,omitempty"` // The query string name to use in GET/HEAD/DELETE requests. (The value "-" indicates to omit the field.) RawTag string `protobuf:"bytes,7,opt,name=raw_tag,json=rawTag,proto3" json:"raw_tag,omitempty"` // The original Go struct tag; should not be parsed individually Tags []*Tag `protobuf:"bytes,8,rep,name=tags,proto3" json:"tags,omitempty"` // Parsed go struct tags. Used for marshalling hints // contains filtered or unexported fields }
Field represents a field within a struct
func (*Field) Descriptor
deprecated
func (*Field) GetJsonName ¶
func (*Field) GetOptional ¶
func (*Field) GetQueryStringName ¶ added in v0.17.2
func (*Field) ProtoMessage ¶
func (*Field) ProtoMessage()
func (*Field) ProtoReflect ¶
func (x *Field) ProtoReflect() protoreflect.Message
type List ¶
type List struct { Elem *Type `protobuf:"bytes,1,opt,name=elem,proto3" json:"elem,omitempty"` // The type of the elements in the list // contains filtered or unexported fields }
List represents a list type (array or slice)
func (*List) Descriptor
deprecated
func (*List) ProtoMessage ¶
func (*List) ProtoMessage()
func (*List) ProtoReflect ¶
func (x *List) ProtoReflect() protoreflect.Message
type Loc ¶
type Loc struct { PkgPath string `protobuf:"bytes,1,opt,name=pkg_path,json=pkgPath,proto3" json:"pkg_path,omitempty"` // The package path within the repo (i.e. `users/signup`) PkgName string `protobuf:"bytes,2,opt,name=pkg_name,json=pkgName,proto3" json:"pkg_name,omitempty"` // The package name (i.e. `signup`) Filename string `protobuf:"bytes,3,opt,name=filename,proto3" json:"filename,omitempty"` // The file name (i.e. `signup.go`) StartPos int32 `protobuf:"varint,4,opt,name=start_pos,json=startPos,proto3" json:"start_pos,omitempty"` // The starting index within the file for this node EndPos int32 `protobuf:"varint,5,opt,name=end_pos,json=endPos,proto3" json:"end_pos,omitempty"` // The ending index within the file for this node SrcLineStart int32 `protobuf:"varint,6,opt,name=src_line_start,json=srcLineStart,proto3" json:"src_line_start,omitempty"` // The starting line within the file for this node SrcLineEnd int32 `protobuf:"varint,7,opt,name=src_line_end,json=srcLineEnd,proto3" json:"src_line_end,omitempty"` // The ending line within the file for this node SrcColStart int32 `protobuf:"varint,8,opt,name=src_col_start,json=srcColStart,proto3" json:"src_col_start,omitempty"` // The starting column on the starting line for this node SrcColEnd int32 `protobuf:"varint,9,opt,name=src_col_end,json=srcColEnd,proto3" json:"src_col_end,omitempty"` // The ending column on the ending line for this node // contains filtered or unexported fields }
Loc is the location of a declaration within the code base
func (*Loc) Descriptor
deprecated
func (*Loc) GetFilename ¶
func (*Loc) GetPkgName ¶
func (*Loc) GetPkgPath ¶
func (*Loc) GetSrcColEnd ¶
func (*Loc) GetSrcColStart ¶
func (*Loc) GetSrcLineEnd ¶
func (*Loc) GetSrcLineStart ¶
func (*Loc) GetStartPos ¶
func (*Loc) ProtoMessage ¶
func (*Loc) ProtoMessage()
func (*Loc) ProtoReflect ¶
func (x *Loc) ProtoReflect() protoreflect.Message
type Map ¶
type Map struct { Key *Type `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` // The type of the key for this map Value *Type `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` // The type of the value of this map // contains filtered or unexported fields }
Map represents a map Type
func (*Map) Descriptor
deprecated
func (*Map) ProtoMessage ¶
func (*Map) ProtoMessage()
func (*Map) ProtoReflect ¶
func (x *Map) ProtoReflect() protoreflect.Message
type Named ¶
type Named struct { Id uint32 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` // The `Decl.id` this name refers to TypeArguments []*Type `protobuf:"bytes,2,rep,name=type_arguments,json=typeArguments,proto3" json:"type_arguments,omitempty"` // The type arguments used to instantiate this parameterised declaration // contains filtered or unexported fields }
Named references declaration block by name
func (*Named) Descriptor
deprecated
func (*Named) GetTypeArguments ¶ added in v0.18.0
func (*Named) ProtoMessage ¶
func (*Named) ProtoMessage()
func (*Named) ProtoReflect ¶
func (x *Named) ProtoReflect() protoreflect.Message
type Pointer ¶ added in v1.8.0
type Pointer struct { Base *Type `protobuf:"bytes,1,opt,name=base,proto3" json:"base,omitempty"` // The type of the pointer // contains filtered or unexported fields }
Pointer represents a pointer to a base type
func (*Pointer) Descriptor
deprecated
added in
v1.8.0
func (*Pointer) ProtoMessage ¶ added in v1.8.0
func (*Pointer) ProtoMessage()
func (*Pointer) ProtoReflect ¶ added in v1.8.0
func (x *Pointer) ProtoReflect() protoreflect.Message
type Struct ¶
type Struct struct { Fields []*Field `protobuf:"bytes,1,rep,name=fields,proto3" json:"fields,omitempty"` // contains filtered or unexported fields }
Struct contains a list of fields which make up the struct
func (*Struct) Descriptor
deprecated
func (*Struct) ProtoMessage ¶
func (*Struct) ProtoMessage()
func (*Struct) ProtoReflect ¶
func (x *Struct) ProtoReflect() protoreflect.Message
type Tag ¶ added in v1.1.0
type Tag struct { Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` // The tag key (e.g. json, query, header ...) Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` // The tag name (e.g. first_name, firstName, ...) Options []string `protobuf:"bytes,3,rep,name=options,proto3" json:"options,omitempty"` // Key Options (e.g. omitempty, optional ...) // contains filtered or unexported fields }
func (*Tag) Descriptor
deprecated
added in
v1.1.0
func (*Tag) GetOptions ¶ added in v1.1.0
func (*Tag) ProtoMessage ¶ added in v1.1.0
func (*Tag) ProtoMessage()
func (*Tag) ProtoReflect ¶ added in v1.1.0
func (x *Tag) ProtoReflect() protoreflect.Message
type Type ¶
type Type struct { // Types that are assignable to Typ: // // *Type_Named // *Type_Struct // *Type_Map // *Type_List // *Type_Builtin // *Type_Pointer // *Type_TypeParameter // *Type_Config Typ isType_Typ `protobuf_oneof:"typ"` // contains filtered or unexported fields }
Type represents the base of our schema on which everything else is built on-top of. It has to be one, and only one, thing from our list of meta types.
A type may be concrete or abstract, however to determine if a type is abstract you need to recursive through the structures looking for any uses of the TypeParameterPtr type
func (*Type) Descriptor
deprecated
func (*Type) GetBuiltin ¶
func (*Type) GetConfig ¶ added in v1.8.0
func (x *Type) GetConfig() *ConfigValue
func (*Type) GetPointer ¶ added in v1.8.0
func (*Type) GetTypeParameter ¶ added in v0.18.0
func (x *Type) GetTypeParameter() *TypeParameterRef
func (*Type) ProtoMessage ¶
func (*Type) ProtoMessage()
func (*Type) ProtoReflect ¶
func (x *Type) ProtoReflect() protoreflect.Message
type TypeParameter ¶ added in v0.18.0
type TypeParameter struct { Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` // The identifier given to the type parameter // contains filtered or unexported fields }
TypeParameter acts as a place holder for an (as of yet) unknown type in the declaration; the type parameter is replaced with a type argument upon instantiation of the parameterized function or type.
func (*TypeParameter) Descriptor
deprecated
added in
v0.18.0
func (*TypeParameter) Descriptor() ([]byte, []int)
Deprecated: Use TypeParameter.ProtoReflect.Descriptor instead.
func (*TypeParameter) GetName ¶ added in v0.18.0
func (x *TypeParameter) GetName() string
func (*TypeParameter) ProtoMessage ¶ added in v0.18.0
func (*TypeParameter) ProtoMessage()
func (*TypeParameter) ProtoReflect ¶ added in v0.18.0
func (x *TypeParameter) ProtoReflect() protoreflect.Message
func (*TypeParameter) Reset ¶ added in v0.18.0
func (x *TypeParameter) Reset()
func (*TypeParameter) String ¶ added in v0.18.0
func (x *TypeParameter) String() string
type TypeParameterRef ¶ added in v0.18.0
type TypeParameterRef struct { DeclId uint32 `protobuf:"varint,1,opt,name=decl_id,json=declId,proto3" json:"decl_id,omitempty"` // The ID of the declaration block ParamIdx uint32 `protobuf:"varint,2,opt,name=param_idx,json=paramIdx,proto3" json:"param_idx,omitempty"` // The index of the type parameter within the declaration block // contains filtered or unexported fields }
TypeParameterRef is a reference to a `TypeParameter` within a declaration block
func (*TypeParameterRef) Descriptor
deprecated
added in
v0.18.0
func (*TypeParameterRef) Descriptor() ([]byte, []int)
Deprecated: Use TypeParameterRef.ProtoReflect.Descriptor instead.
func (*TypeParameterRef) GetDeclId ¶ added in v0.18.0
func (x *TypeParameterRef) GetDeclId() uint32
func (*TypeParameterRef) GetParamIdx ¶ added in v0.18.0
func (x *TypeParameterRef) GetParamIdx() uint32
func (*TypeParameterRef) ProtoMessage ¶ added in v0.18.0
func (*TypeParameterRef) ProtoMessage()
func (*TypeParameterRef) ProtoReflect ¶ added in v0.18.0
func (x *TypeParameterRef) ProtoReflect() protoreflect.Message
func (*TypeParameterRef) Reset ¶ added in v0.18.0
func (x *TypeParameterRef) Reset()
func (*TypeParameterRef) String ¶ added in v0.18.0
func (x *TypeParameterRef) String() string
type Type_Builtin ¶
type Type_Builtin struct {
Builtin Builtin `protobuf:"varint,5,opt,name=builtin,proto3,enum=encore.parser.schema.v1.Builtin,oneof"` // The type is one of the base built in types within Go
}
type Type_Config ¶ added in v1.8.0
type Type_Config struct { // Encore Special Types Config *ConfigValue `protobuf:"bytes,7,opt,name=config,proto3,oneof"` // This value is a config value }
type Type_List ¶
type Type_List struct {
List *List `protobuf:"bytes,4,opt,name=list,proto3,oneof"` // The type is a slice
}
type Type_Map ¶
type Type_Map struct {
Map *Map `protobuf:"bytes,3,opt,name=map,proto3,oneof"` // The type is a map
}
type Type_Named ¶
type Type_Named struct { // Concrete / non-parameterized Types Named *Named `protobuf:"bytes,1,opt,name=named,proto3,oneof"` // A "named" type (https://tip.golang.org/ref/spec#Types) }
type Type_Pointer ¶ added in v1.8.0
type Type_Pointer struct {
Pointer *Pointer `protobuf:"bytes,8,opt,name=pointer,proto3,oneof"` // The type is a pointer
}
type Type_Struct ¶
type Type_Struct struct {
Struct *Struct `protobuf:"bytes,2,opt,name=struct,proto3,oneof"` // The type is a struct definition
}
type Type_TypeParameter ¶ added in v0.18.0
type Type_TypeParameter struct { // Abstract Types TypeParameter *TypeParameterRef `protobuf:"bytes,6,opt,name=type_parameter,json=typeParameter,proto3,oneof"` // This is placeholder for a unknown type within the declaration block }