codegen

package
v1.5.5 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2024 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var E_RUST_MODULE = &protoimpl.ExtensionInfo{
	ExtendedType:  (*descriptorpb.FileOptions)(nil),
	ExtensionType: (*string)(nil),
	Field:         56781,
	Name:          "rust_module",
	Tag:           "bytes",
}
View Source
var ErrInvalidEthereumChain = fmt.Errorf("not a valid EthereumChain, try [%s]", strings.Join(_EthereumChainNames, ", "))
View Source
var ErrInvalidProtocol = fmt.Errorf("not a valid Protocol, try [%s]", strings.Join(_ProtocolNames, ", "))
View Source
var StoreType = map[string]string{
	"bytes":      "Raw",
	"string":     "String",
	"bigint":     "BigInt",
	"bigdecimal": "BigDecimal",
	"bigfloat":   "BigDecimal",
	"int64":      "Int64",
	"i64":        "Int64",
	"float64":    "Float64",
	"boolean":    "bool",
}
View Source
var UpdatePoliciesMap = map[string]string{
	"":                                  "Unset",
	manifest.UpdatePolicySet:            "Set",
	manifest.UpdatePolicySetIfNotExists: "SetIfNotExists",
	manifest.UpdatePolicyAdd:            "Add",
	manifest.UpdatePolicyMin:            "Min",
	manifest.UpdatePolicyMax:            "Max",
	manifest.UpdatePolicyAppend:         "Append",
}

Functions

func EthereumChainNames added in v1.1.9

func EthereumChainNames() []string

EthereumChainNames returns a list of possible string values of EthereumChain.

func ProtocolNames added in v1.0.2

func ProtocolNames() []string

ProtocolNames returns a list of possible string values of Protocol.

Types

type Argument

type Argument struct {
	Name        string
	Type        string
	ModuleInput *manifest.Input
}

func NewArgument

func NewArgument(name string, argType string, moduleInput *manifest.Input) *Argument

type Arguments

type Arguments []*Argument

type Engine

type Engine struct {
	Manifest *manifest.Manifest
}

func (*Engine) FunctionSignature

func (e *Engine) FunctionSignature(module *manifest.Module) (*FunctionSignature, error)

func (*Engine) GetEngine

func (e *Engine) GetEngine() *Engine

func (*Engine) ModuleArgument

func (e *Engine) ModuleArgument(inputs []*manifest.Input) (Arguments, error)

func (*Engine) MustModule

func (e *Engine) MustModule(moduleName string) *manifest.Module

func (*Engine) ReadableStoreDeclaration added in v0.1.0

func (e *Engine) ReadableStoreDeclaration(name string, store *manifest.Module, input *manifest.Input) string

func (*Engine) ReadableStoreType added in v0.1.0

func (e *Engine) ReadableStoreType(store *manifest.Module, input *manifest.Input) string

func (*Engine) WritableStoreDeclaration added in v0.1.0

func (e *Engine) WritableStoreDeclaration(store *manifest.Module) string

func (*Engine) WritableStoreType added in v0.1.0

func (e *Engine) WritableStoreType(store *manifest.Module) string

type EthereumChain added in v1.1.9

type EthereumChain uint

ENUM(

Mainnet BNB Polygon Goerli Mumbai // Sepolia Other

)

const (
	// EthereumChainMainnet is a EthereumChain of type Mainnet.
	EthereumChainMainnet EthereumChain = iota
	// EthereumChainBNB is a EthereumChain of type BNB.
	EthereumChainBNB
	// EthereumChainPolygon is a EthereumChain of type Polygon.
	EthereumChainPolygon
	// EthereumChainArbitrum is a EthereumChain of type Arbitrum.
	EthereumChainArbitrum
	// EthereumChainGoerli is a EthereumChain of type Goerli.
	EthereumChainGoerli
	// EthereumChainMumbai is a EthereumChain of type Mumbai.
	EthereumChainMumbai
	// EthereumChainOther is a EthereumChain of type Other.
	EthereumChainOther
)

func ParseEthereumChain added in v1.1.9

func ParseEthereumChain(name string) (EthereumChain, error)

ParseEthereumChain attempts to convert a string to a EthereumChain.

func (EthereumChain) IsValid added in v1.1.9

func (x EthereumChain) IsValid() bool

IsValid provides a quick way to determine if the typed value is part of the allowed enumerated values

func (EthereumChain) MarshalText added in v1.1.9

func (x EthereumChain) MarshalText() ([]byte, error)

MarshalText implements the text marshaller method.

func (EthereumChain) String added in v1.1.9

func (x EthereumChain) String() string

String implements the Stringer interface.

func (*EthereumChain) UnmarshalText added in v1.1.9

func (x *EthereumChain) UnmarshalText(text []byte) error

UnmarshalText implements the text unmarshaller method.

type FunctionSignature

type FunctionSignature struct {
	Name        string
	Type        string
	OutputType  string
	StorePolicy string
	Arguments   Arguments
}

func NewFunctionSignature

func NewFunctionSignature(name string, t string, outType string, storePolicy string, arguments Arguments) *FunctionSignature

type GenerationOptions

type GenerationOptions func(options *generateOptions)

func WithTestWriter

func WithTestWriter(w io.Writer) GenerationOptions

type Generator

type Generator struct {
	// contains filtered or unexported fields
}

func NewGenerator

func NewGenerator(pkg *pbsubstreams.Package, manifest *manifest.Manifest, protoDefinitions []*desc.FileDescriptor, srcPath string) *Generator

func (*Generator) Generate

func (g *Generator) Generate() (err error)

type ProtoGenerator

type ProtoGenerator struct {
	// contains filtered or unexported fields
}

func NewProtoGenerator

func NewProtoGenerator(outputPath string, excludedPaths []string, generateMod bool) *ProtoGenerator

func (*ProtoGenerator) GenerateProto added in v0.1.0

func (g *ProtoGenerator) GenerateProto(pkg *pbsubstreams.Package, showBufContent bool) error

type Protocol added in v1.0.2

type Protocol uint

ENUM(

Ethereum
Other

)

const (
	// ProtocolEthereum is a Protocol of type Ethereum.
	ProtocolEthereum Protocol = iota
	// ProtocolOther is a Protocol of type Other.
	ProtocolOther
)

func ParseProtocol added in v1.0.2

func ParseProtocol(name string) (Protocol, error)

ParseProtocol attempts to convert a string to a Protocol.

func (Protocol) IsValid added in v1.0.2

func (x Protocol) IsValid() bool

IsValid provides a quick way to determine if the typed value is part of the allowed enumerated values

func (Protocol) MarshalText added in v1.0.2

func (x Protocol) MarshalText() ([]byte, error)

MarshalText implements the text marshaller method.

func (Protocol) String added in v1.0.2

func (x Protocol) String() string

String implements the Stringer interface.

func (*Protocol) UnmarshalText added in v1.0.2

func (x *Protocol) UnmarshalText(text []byte) error

UnmarshalText implements the text unmarshaller method.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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