genhelper

package
v0.5.9 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2019 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package genhelper provides with utilities to generate codes

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Render

func Render(fn string, header string, tmpl string, datas []interface{}, linters []string)

Render generate a file "fn". File content is defined by a "header", a repeated body template "tmpl" and slice of "data" to render the body template. Additianlly some linters can be specified to run after generating. Supported linters are "gofmt" and "unconvert".

Types

type IntConfig

type IntConfig struct {
	// Name of the data type.
	Name string
	// ValType is the actual underlying int type, such as int32.
	ValType string
	// ValLen specifies the length of ValType
	ValLen int
	// Decoder defines the name of function to decode raw bytes into ValType.
	Decoder string
	// EncodeCast defines a cast type/function to convert values before encode.
	// Because sometimes encoder does not provides a exact type.
	EncodeCast string
}

IntConfig defines a integer type based template redner config.

Jump to

Keyboard shortcuts

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