codegen

package
v0.0.21 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2022 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const EthereumBlockManifest = "sf.ethereum.type.v2.Block"
View Source
const EthereumBlockRust = "substreams_ethereum::pb::eth::v2::Block"
View Source
const SubstreamsClock = "sf.substreams.v1.Clock"
View Source
const SubstreamsClockRust = "substreams::pb::substreams::Clock"

Variables

View Source
var StoreType = map[string]string{
	"bytes":      "Raw",
	"string":     "String",
	"bigint":     "BigInt",
	"bigdecimal": "BigDecimal",
	"bigfloat":   "BigDecimal",
	"int64":      "I64",
	"i64":        "I64",
	"float64":    "Float64",
}
View Source
var UpdatePoliciesMap = map[string]string{
	"UPDATE_POLICY_UNSET":             "Unset",
	"UPDATE_POLICY_SET":               "Set",
	"UPDATE_POLICY_SET_IF_NOT_EXISTS": "SetIfNotExist",
	"UPDATE_POLICY_ADD":               "Add",
	"UPDATE_POLICY_MIN":               "Min",
	"UPDATE_POLICY_MAX":               "Max",
	"UPDATE_POLICY_APPEND":            "Append",
}

Functions

func IsDelta

func IsDelta(input *pbsubstreams.Module_Input) bool

func IsMapInput

func IsMapInput(input *pbsubstreams.Module_Input) bool

func IsMapModule

func IsMapModule(module *pbsubstreams.Module) bool

func IsStoreInput

func IsStoreInput(input *pbsubstreams.Module_Input) bool

func IsStoreModule

func IsStoreModule(module *pbsubstreams.Module) bool

func ReadableStoreDeclaration

func ReadableStoreDeclaration(name string, store *pbsubstreams.Module_KindStore, input *pbsubstreams.Module_Input_Store) string

func WritableStoreDeclaration

func WritableStoreDeclaration(store *pbsubstreams.Module_KindStore) string

func WritableStoreType

func WritableStoreType(store *pbsubstreams.Module_KindStore) string

Types

type Argument

type Argument struct {
	Name        string
	Type        string
	ModuleInput *pbsubstreams.Module_Input
}

func NewArgument

func NewArgument(name string, argType string, moduleInput *pbsubstreams.Module_Input) *Argument

type Arguments

type Arguments []*Argument

type Engine

type Engine struct {
	Package *pbsubstreams.Package
}

func (*Engine) Arguments

func (e *Engine) Arguments(module *pbsubstreams.Module) ([]string, error)

func (*Engine) FunctionSignature

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

func (*Engine) GetEngine

func (e *Engine) GetEngine() *Engine

func (*Engine) ModuleArgument

func (e *Engine) ModuleArgument(inputs []*pbsubstreams.Module_Input) (Arguments, error)

func (*Engine) MustModule

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

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 pbsubstreams.Module_KindStore_UpdatePolicy, 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, 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) *ProtoGenerator

func (*ProtoGenerator) Generate

func (g *ProtoGenerator) Generate(pkg *pbsubstreams.Package) error

Jump to

Keyboard shortcuts

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