model

package
v1.5.1-rc.1 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultVersion = "0.0.1"
)

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

This section is empty.

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
	Comment    string
	FldComment string
	IsArray    bool
	IsBaseType bool
	IsOptional bool
	Line       int // the line number originally in yaml file
	MapKey     string
	Type       string
}

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
	Alias   string
	Access  DefElt
	Comment string
	Hname   isc.Hname
	Kind    string
	Line    int
	Params  []*Field
	Results []*Field
}

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 {
	Copyright   string        `yaml:"copyright"`
	Name        string        `yaml:"name"`
	Version     string        `yaml:"version"`
	Description string        `yaml:"description"`
	Author      string        `yaml:"author"`
	License     string        `yaml:"license"`
	Repository  string        `yaml:"repository"`
	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 {
	ContractName  string
	PackageName   string
	Author        string
	Copyright     string
	Description   string
	License       string
	Repository    string
	Version       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 {
	Name        DefElt
	Author      DefElt
	Copyright   string
	Description DefElt
	License     DefElt
	Repository  DefElt
	Version     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