Documentation ¶
Index ¶
- Constants
- Variables
- func Align(t *Type) int
- func AlignDown(n, a uintptr) uintptr
- func AlignUp(n, a uintptr) uintptr
- func Capitalize(s string) string
- func DivRoundUp(n, a uintptr) uintptr
- func FieldAlign(size int) int
- func IsLetter(c byte) bool
- func IsLower(c byte) bool
- func IsNumeral(c byte) bool
- func IsUpper(c byte) bool
- func IsValidFirst(c rune) bool
- func IsValidName(n string) bool
- func IsValidNameCharacter(c rune) bool
- func IsWhitespace(c byte) bool
- func Join(left, right string) string
- func PackageName(path string) string
- func PadEnd(s string, l int) string
- func ParseInt(kind Kind, v string) (interface{}, error)
- func RelativePath(base, relative string) string
- func SimpleName(str string) string
- func StartsWith(val string, s string) bool
- func Uncapitalize(s string) string
- type Annotation
- type Builder
- type Const
- type ConstVal
- type Dir
- type Enum
- type EnumOption
- type Expression
- type File
- type Import
- type ImportedName
- type Imports
- type Kind
- type Line
- type List
- type Map
- type Message
- type MessageField
- type Nil
- type Optional
- type Package
- type Parser
- type ProtoBufKind
- type Record
- type Schema
- type Struct
- type StructField
- type Type
- type Union
- type UnionOption
- type VirtualDir
- type VirtualFile
Constants ¶
View Source
const ( MapHeaderSize = 4 MapItemHeaderSize = 4 )
View Source
const ( KindUnknown = Kind(0) // Possibly resolved later KindBool = Kind(1) KindByte = Kind(2) KindInt8 = Kind(3) KindInt16 = Kind(4) KindUInt16 = Kind(5) KindInt32 = Kind(6) KindUInt32 = Kind(7) KindInt64 = Kind(8) KindUInt64 = Kind(9) KindFloat32 = Kind(10) KindFloat64 = Kind(11) KindString = Kind(12) KindBytes = Kind(13) KindStruct = Kind(30) // User-defined structure KindEnum = Kind(31) // User-defined enum KindUnion = Kind(33) // User-defined union KindMessage = Kind(40) // User-defined message KindList = Kind(50) KindMap = Kind(60) KindPad = Kind(100) // struct alignment padding )
View Source
const (
FileSuffix = ".wap"
)
Variables ¶
View Source
var (
ErrUnresolved = errors.New("unresolved")
)
Functions ¶
func Capitalize ¶
func FieldAlign ¶
func IsValidFirst ¶
func IsValidName ¶
func IsValidNameCharacter ¶
func IsWhitespace ¶
func PackageName ¶
func RelativePath ¶
func SimpleName ¶
func StartsWith ¶
func Uncapitalize ¶
Types ¶
type Annotation ¶
type Builder ¶
func NewBuilder ¶
func NewBuilder() *Builder
type Enum ¶
type Enum struct { Name string Type *Type Options []*EnumOption // contains filtered or unexported fields }
func (*Enum) GetOption ¶
func (e *Enum) GetOption(name string) *EnumOption
func (*Enum) OptionMap ¶
func (e *Enum) OptionMap() map[string]*EnumOption
type EnumOption ¶
type Expression ¶
type Expression string
type File ¶
type File struct { Dir string Name string Path string Package string Hash uint64 Err error Content string Imports []*Imports Consts []*Const Structs []*Struct Messages []*Message Enums []*Enum Unions []*Union Lists map[string][]*Type Types map[string]*Type ImportMap map[string]*Import Strings map[string][]*Type // contains filtered or unexported fields }
type ImportedName ¶
type Message ¶
type Message struct { Name string Type *Type Fields []*MessageField FieldMap map[string]*MessageField Optionals []*MessageField Version int64 }
type MessageField ¶
type ProtoBufKind ¶
type ProtoBufKind byte
type Record ¶
type Record struct { }
Record provides an efficient variable length flat layout. It extends structs with the ability to have variable length strings, lists and other Records. It is similar to FlatBuffer Tables.
type Schema ¶
type Schema struct { //Root *Dir Files map[string]*File Errors []error // contains filtered or unexported fields }
func LoadFromFS ¶
LoadFromFS loads a schema from the filesystem optionally resolving.
type Struct ¶
type Struct struct { Name string Type *Type Fields []*StructField FieldMap map[string]*StructField Optionals []*StructField Version int64 Compact bool }
Struct represent a fixed sized memory layout similar to how structs memory layout in languages such as Go, Rust, C/C++, etc. Optionally structs can be compact which removes all padding which favors memory size vs CPU cache aligning. For variable memory sizes, use Record.
type StructField ¶
type StructField struct { Number int Struct *Struct Name string Short string Type *Type Offset int OptOffset int OptMask byte }
func (*StructField) IsOptional ¶
func (f *StructField) IsOptional() bool
type Type ¶
type Type struct { Line Line File *File Kind Kind Optional bool Resolved bool Size int Len int // Max length if collection (list or map) or string HeaderSize int HeaderOffset int Padding int Element *Type // List element or Map key type Value *Type // Value type if map type ItemSize int Import *Import Name string // Name of type Comments []string // Comments Description string // Description are comments to the right of certain declarations Const *Const // Const if type represents a single const Struct *Struct // Struct for 'KindStruct' Field *StructField // Field Union *Union // Union for 'KindUnion' UnionOption *UnionOption // UnionOption if type represents a single union option Enum *Enum // Enum for 'KindEnum' EnumOption *EnumOption // EnumOption if type represents a single enum option Init interface{} // Initial value }
type UnionOption ¶
type VirtualDir ¶
type VirtualDir struct { Name string `json:"name"` Path string `json:"path"` Dirs []VirtualDir `json:"dirs"` Files []VirtualFile `json:"files"` }
type VirtualFile ¶
Click to show internal directories.
Click to hide internal directories.