codegen

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2023 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultProjectVersion = "0.0.0"
View Source
var DefaultRustVersion = "1.60.0"
View Source
var DefaultSubstreamsVersion = "0.4.0"
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 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

This section is empty.

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 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 ProjectGenerator added in v0.1.0

type ProjectGenerator struct {
	ProjectName       string
	ProjectVersion    string
	RustVersion       string
	SubstreamsVersion string
	// contains filtered or unexported fields
}

func NewProjectGenerator added in v0.1.0

func NewProjectGenerator(srcPath, projectName string, opts ...ProjectGeneratorOption) *ProjectGenerator

func (*ProjectGenerator) GenerateProject added in v0.1.0

func (g *ProjectGenerator) GenerateProject() error

type ProjectGeneratorOption added in v0.1.0

type ProjectGeneratorOption func(*ProjectGenerator)

func WithProjectVersion added in v0.1.0

func WithProjectVersion(version string) ProjectGeneratorOption

func WithRustVersion added in v0.1.0

func WithRustVersion(version string) ProjectGeneratorOption

type ProtoGenerator

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

func NewProtoGenerator

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

func (*ProtoGenerator) GenerateProto added in v0.1.0

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

Jump to

Keyboard shortcuts

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