model

package
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2021 License: Apache-2.0, BSD-2-Clause Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var FieldTypes = map[string]int32{
	"Address":   wasmlib.TYPE_ADDRESS,
	"AgentID":   wasmlib.TYPE_AGENT_ID,
	"Bool":      wasmlib.TYPE_BOOL,
	"Bytes":     wasmlib.TYPE_BYTES,
	"ChainID":   wasmlib.TYPE_CHAIN_ID,
	"Color":     wasmlib.TYPE_COLOR,
	"Hash":      wasmlib.TYPE_HASH,
	"Hname":     wasmlib.TYPE_HNAME,
	"Int8":      wasmlib.TYPE_INT8,
	"Int16":     wasmlib.TYPE_INT16,
	"Int32":     wasmlib.TYPE_INT32,
	"Int64":     wasmlib.TYPE_INT64,
	"RequestID": wasmlib.TYPE_REQUEST_ID,
	"String":    wasmlib.TYPE_STRING,
	"Uint8":     wasmlib.TYPE_INT8,
	"Uint16":    wasmlib.TYPE_INT16,
	"Uint32":    wasmlib.TYPE_INT32,
	"Uint64":    wasmlib.TYPE_INT64,
}

Functions

This section is empty.

Types

type Field

type Field struct {
	Name     string // external name for this field
	Alias    string // internal name alias, can be different from Name
	Array    bool
	Comment  string
	KeyID    int
	MapKey   string
	Optional bool
	Type     string
	TypeID   int32
}

func (*Field) Compile

func (f *Field) Compile(s *Schema, fldName, fldType string) error

type FieldMap

type FieldMap map[string]*Field

TODO describe schema details in docs

type FieldMapMap

type FieldMapMap map[string]FieldMap

TODO describe schema details in docs

type Func

type Func struct {
	Name    string
	Access  string
	Kind    string
	Hname   iscp.Hname
	Params  []*Field
	Results []*Field
}

type FuncDef

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

type FuncDefMap

type FuncDefMap map[string]*FuncDef

type Schema

type Schema struct {
	ContractName  string
	PackageName   string
	Description   string
	KeyID         int
	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        string       `json:"name" yaml:"name"`
	Description string       `json:"description" yaml:"description"`
	Events      StringMapMap `json:"events" yaml:"events"`
	Structs     StringMapMap `json:"structs" yaml:"structs"`
	Typedefs    StringMap    `json:"typedefs" yaml:"typedefs"`
	State       StringMap    `json:"state" yaml:"state"`
	Funcs       FuncDefMap   `json:"funcs" yaml:"funcs"`
	Views       FuncDefMap   `json:"views" yaml:"views"`
}

type StringMap

type StringMap map[string]string

TODO describe schema details in docs

type StringMapMap

type StringMapMap map[string]StringMap

TODO describe schema details in docs

type Struct

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

Jump to

Keyboard shortcuts

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