generate

package
v0.0.14 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2022 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultTSCaseFunc = strcase.UpperCamelCase
View Source
var LanguageMapping = map[string]map[string]LanguageFieldMapping{
	"bool": {
		"ts": {
			Type:             "boolean",
			IntermediateType: "number",
			Func:             "!!",
		},
	},
	"int8": {
		"ts": {
			Type: "number",
		},
	},
	"uint8": {
		"ts": {
			Type: "number",
		},
	},
	"int16": {
		"ts": {
			Type: "number",
		},
	},
	"uint16": {
		"ts": {
			Type: "number",
		},
	},
	"int32": {
		"ts": {
			Type: "number",
		},
	},
	"varint32": {
		"ts": {
			Type: "number",
		},
	},
	"uint32": {
		"ts": {
			Type: "number",
		},
	},
	"varuint32": {
		"ts": {
			Type: "number",
		},
	},
	"int64": {
		"ts": {
			Type:             "string",
			IntermediateType: "number",
			Method:           "toString",
			RawType:          "string | number",
		},
	},
	"uint64": {
		"ts": {
			Type:             "string",
			IntermediateType: "number",
			Method:           "toString",
			RawType:          "string | number",
		},
	},
	"int128": {
		"ts": {
			Type: "string",
		},
	},
	"uint128": {
		"ts": {
			Type: "string",
		},
	},
	"float32": {
		"ts": {
			Type:             "number",
			Func:             "Number.parseFloat",
			IntermediateType: "string",
		},
	},
	"float64": {
		"ts": {
			Type:             "number",
			Func:             "Number.parseFloat",
			IntermediateType: "string",
		},
	},
	"float128": {
		"ts": {
			Type: "string",
		},
	},
	"time_point": {
		"ts": {
			Type: "string",
		},
	},
	"time_point_sec": {
		"ts": {
			Type: "string",
		},
	},
	"block_timestamp_type": {
		"ts": {
			Type: "string",
		},
	},
	"name": {
		"ts": {
			Type: "string",
		},
	},
	"bytes": {
		"ts": {
			Type: "string",
		},
	},
	"string": {
		"ts": {
			Type: "string",
		},
	},
	"checksum160": {
		"ts": {
			Type: "string",
		},
	},
	"checksum256": {
		"ts": {
			Type: "string",
		},
	},
	"checksum512": {
		"ts": {
			Type: "string",
		},
	},
	"public_key": {
		"ts": {
			Type: "string",
		},
	},
	"signature": {
		"ts": {
			Type: "string",
		},
	},
	"symbol": {
		"ts": {
			Type:             "Symbol",
			Func:             "new types.Symbol",
			FullType:         "types.Symbol",
			IntermediateType: "string",
		},
	},
	"symbol_code": {
		"ts": {
			Type: "string",
		},
	},
	"asset": {
		"ts": {
			Type:             "Asset",
			Func:             "new types.Asset",
			IntermediateType: "string",
			FullType:         "types.Asset",
		},
	},
	"extended_asset": {
		"ts": {
			Type:                 "ExtendedAsset",
			Func:                 "new types.ExtendedAsset",
			IntermediateType:     "ExtendedAssetType",
			FullType:             "types.ExtendedAsset",
			IntermediateFullType: "types.ExtendedAssetType",
		},
	},
}

Functions

func Run

func Run(opts Opts) error

Types

type Action added in v0.0.6

type Action struct {
	Name       string
	ParamsName string
}

type Field

type Field struct {
	Name                 string
	Type                 string
	FullType             string
	IntermediateType     string
	IntermediateFullType string
	RawType              string
	Func                 string
	Method               string
	ArraysCount          int
	IsStruct             bool
	GenerateMapper       bool
}

func (Field) FormatArrayValue added in v0.0.10

func (f Field) FormatArrayValue(n string, useFullType bool) string

func (Field) FormatNameValue added in v0.0.5

func (f Field) FormatNameValue(obj string, useFullType bool) string

type LanguageFieldMapping

type LanguageFieldMapping struct {
	Type                 string
	Func                 string
	Method               string
	IntermediateType     string
	IntermediateFullType string
	FullType             string
	RawType              string
}

type Method

type Method struct {
	MethodName     string
	TableName      string
	ReturnName     string
	Struct         Struct
	ReturnNameRows string
}

type Opts

type Opts struct {
	ContractFilePath     string
	ContractNameOverride string
	GeneratedFolder      string
	Version              string
	FS                   afero.Fs
}

type S

type S struct {
	Name   string
	Fields []Field
}

type Struct added in v0.0.3

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