model

package
v0.5.0-alpha.1 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var FieldTypes = map[string]bool{
	"Address":   true,
	"AgentID":   true,
	"BigInt":    true,
	"Bool":      true,
	"Bytes":     true,
	"ChainID":   true,
	"Hash":      true,
	"Hname":     true,
	"Int8":      true,
	"Int16":     true,
	"Int32":     true,
	"Int64":     true,
	"NftID":     true,
	"RequestID": true,
	"String":    true,
	"TokenID":   true,
	"Uint8":     true,
	"Uint16":    true,
	"Uint32":    true,
	"Uint64":    true,
}

Functions

func LineErrorf added in v0.3.0

func LineErrorf(lineNr int, format string, args ...interface{}) error

Types

type DefElt added in v0.3.0

type DefElt struct {
	Val     string
	Comment string
	Line    int
}

type DefEltList added in v0.3.0

type DefEltList []DefElt

func (DefEltList) Len added in v0.3.0

func (l DefEltList) Len() int

func (DefEltList) Less added in v0.3.0

func (l DefEltList) Less(i, j int) bool

func (DefEltList) Swap added in v0.3.0

func (l DefEltList) Swap(i, j int)

type DefMap added in v0.3.0

type DefMap map[DefElt]*DefElt

func (DefMap) ToStringMap added in v0.3.0

func (m DefMap) ToStringMap() StringMap

type DefMapMap added in v0.3.0

type DefMapMap map[DefElt]*DefMap

func (DefMapMap) ToStringMapMap added in v0.3.0

func (m DefMapMap) ToStringMapMap() StringMapMap

type DefNameMap added in v0.3.0

type DefNameMap map[string]*DefElt

type DefNameMapMap added in v0.3.0

type DefNameMapMap map[string]*DefMap

type Field

type Field struct {
	Name       string // external name for this field
	Alias      string // internal name alias, can be different from Name
	Array      bool
	FldComment string
	MapKey     string
	Optional   bool
	Type       string
	BaseType   bool
	Comment    string
	Line       int // the line number originally in yaml file
}

func (*Field) Compile

func (f *Field) Compile(s *Schema, fldNameDef, fldTypeDef *DefElt) error

type FieldMap

type FieldMap map[string]*Field

type Func

type Func struct {
	Name    string
	Access  DefElt
	Kind    string
	Hname   isc.Hname
	Params  []*Field
	Results []*Field
	Line    int
	Comment string
}

type FuncDef

type FuncDef struct {
	Access  DefElt
	Params  DefMap
	Results DefMap
	Line    int
	Comment string
}

type FuncDefMap

type FuncDefMap map[DefElt]*FuncDef

func (FuncDefMap) ToRawFuncDefMap added in v0.3.0

func (m FuncDefMap) ToRawFuncDefMap() RawFuncDefMap

type FuncNameDefMap added in v0.3.0

type FuncNameDefMap map[string]*FuncDef

type JSONSchemaDef added in v0.3.0

type JSONSchemaDef RawSchemaDef

type RawFuncDef added in v0.3.0

type RawFuncDef struct {
	Access  string    `yaml:"access,omitempty"`
	Params  StringMap `yaml:"params,omitempty"`
	Results StringMap `yaml:"results,omitempty"`
}

type RawFuncDefMap added in v0.3.0

type RawFuncDefMap map[string]*RawFuncDef

func (RawFuncDefMap) ToFuncDefMap added in v0.3.0

func (m RawFuncDefMap) ToFuncDefMap() FuncDefMap

type RawSchemaDef added in v0.3.0

type RawSchemaDef struct {
	Name        string        `yaml:"name"`
	Description string        `yaml:"description"`
	Author      string        `yaml:"author"`
	Events      StringMapMap  `yaml:"events"`
	Structs     StringMapMap  `yaml:"structs"`
	Typedefs    StringMap     `yaml:"typedefs"`
	State       StringMap     `yaml:"state"`
	Funcs       RawFuncDefMap `yaml:"funcs"`
	Views       RawFuncDefMap `yaml:"views"`
}

func (*RawSchemaDef) ToSchemaDef added in v1.0.3

func (s *RawSchemaDef) ToSchemaDef() *SchemaDef

type Schema

type Schema struct {
	Author        string
	ContractName  string
	Copyright     string
	PackageName   string
	Description   string
	CoreContracts bool
	SchemaTime    time.Time
	Events        []*Struct
	Funcs         []*Func
	Params        []*Field
	Results       []*Field
	StateVars     []*Field
	Structs       []*Struct
	Typedefs      []*Field
}

func NewSchema

func NewSchema() *Schema

func (*Schema) Compile

func (s *Schema) Compile(schemaDef *SchemaDef) error

type SchemaDef

type SchemaDef struct {
	Copyright   string
	Name        DefElt
	Description DefElt
	Author      DefElt
	Events      DefMapMap
	Structs     DefMapMap
	Typedefs    DefMap
	State       DefMap
	Funcs       FuncDefMap
	Views       FuncDefMap
}

func NewSchemaDef added in v0.3.0

func NewSchemaDef() *SchemaDef

func (*SchemaDef) ToRawSchemaDef added in v0.3.0

func (s *SchemaDef) ToRawSchemaDef() *RawSchemaDef

type StringMap

type StringMap map[string]string

func (StringMap) ToDefMap added in v0.3.0

func (mm StringMap) ToDefMap() DefMap

type StringMapMap

type StringMapMap map[string]StringMap

func (StringMapMap) ToDefMapMap added in v0.3.0

func (mm StringMapMap) ToDefMapMap() DefMapMap

type Struct

type Struct struct {
	Name   DefElt
	Fields []*Field
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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