gen

package
v0.0.0-...-2646333 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2020 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package gen contains all the components for code generation.

Package gen contains all the components for code generation.

Package gen contains all the components for code generation.

Package gen contains all the components for code generation.

Package gen contains all the components for code generation.

Package gen contains all the components for code generation.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateEventHandlerLists

func GenerateEventHandlerLists(writer io.Writer, packageName string) error

GenerateEventHandlerLists will code gen a function around the event filterers/watchers to return a list of filterers/watchers based on a map of contract simple names to contract address.

func GenerateEventHandlers

func GenerateEventHandlers(writer io.Writer, contractType specs.ContractType, packageName string,
	handlerName string) error

GenerateEventHandlers will code gen the contract event handlers for a given ContractType. It will output the generated code to the given io.Writer.

func GenerateEventHandlersFromTemplate

func GenerateEventHandlersFromTemplate(writer io.Writer, tmplData *EventHandlerContractTmplData,
	gofmt bool, handlerName string) error

GenerateEventHandlersFromTemplate will code gen the contract event handlers for the given contract data. It will output the generated code to the given io.Writer. If gofmt is true, will run go formatting on the code before output. packageName specifies for listener or retriever code

Types

type EventHandlerContractTmplData

type EventHandlerContractTmplData struct {
	PackageName         string
	AdditionalImports   []string
	ContractImportPath  string
	ContractTypePackage string
	ContractTypeName    string
	DefaultStartBlock   int
	GenTime             time.Time
	EventHandlers       []*EventHandlerTmplData
}

EventHandlerContractTmplData represents data for a category of contract event methods. Maps to actions in the event handler templates.

type EventHandlerListContractTmplData

type EventHandlerListContractTmplData struct {
	Name       string
	SimpleName string
}

EventHandlerListContractTmplData represents the names of the contracts to list

type EventHandlerListTmplData

type EventHandlerListTmplData struct {
	PackageName string
	GenTime     time.Time
	Contracts   []*EventHandlerListContractTmplData
}

EventHandlerListTmplData represents the data passed to the EventHandlerList template.

type EventHandlerMethodParam

type EventHandlerMethodParam struct {
	Type string
}

EventHandlerMethodParam represents a value to be passed into the method for starting up event handlers in a smart contract. Maps to actions in the event handler templates.

type EventHandlerTmplData

type EventHandlerTmplData struct {
	EventMethod string
	EventType   string
	ParamValues []*EventHandlerMethodParam
	EventName   string
}

EventHandlerTmplData represents data for an individual contract event method in a smart contract. Maps to actions in the event handler templates.

type TemplateData

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

TemplateData is a struct to store template information

Jump to

Keyboard shortcuts

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