render

package
v0.0.0-...-f860bb7 Latest Latest
Warning

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

Go to latest
Published: May 29, 2018 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Manifest

type Manifest struct {
	ScanTypeMap string `json:"scan_type_map"` // required
	Templates   struct {
		Table     string   `json:"table"`      // required
		TableTest string   `json:"table_test"` // optional
		Stmt      string   `json:"stmt"`       // required
		StmtTest  string   `json:"stmt_test"`  // optional
		Extra     []string `json:"extra"`      // optional
	} `json:"tmpl"`
}

func NewManifest

func NewManifest(r io.Reader) (*Manifest, error)

type Option

type Option func(*Renderer) error

Option is used to create Renderer.

func Blacklist

func Blacklist(blacklist []string) Option

Blacklist sets the blacklist of table names not to render.

func Loader

func Loader(loader *datasrc.Loader) Option

Loader sets the loader. (required)

func OutputDir

func OutputDir(outputDir string) Option

OutputDir sets the directory for generated code. (required)

func OutputPkg

func OutputPkg(outputPkg string) Option

OutputPkg sets an alternative package name for generated code.

func StmtDir

func StmtDir(stmtDir string) Option

StmtDir sets the directory containing statement XMLs.

func TmplFS

func TmplFS(tmplFS http.FileSystem) Option

TmplFS sets the template directory. (required)

func Whitelist

func Whitelist(whitelist []string) Option

Whitelist sets the whitelist of table names to render.

type Renderer

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

Renderer is used for generating code.

func NewRenderer

func NewRenderer(opts ...Option) (*Renderer, error)

NewRenderer create new Renderer.

func (*Renderer) Run

func (r *Renderer) Run() error

Run generate code.

type ScanTypeMap

type ScanTypeMap map[string][2]string

ScanTypeMap maps data type to scan type. [0] is for not nullable types. [1] is for nullable types.

func NewScanTypeMap

func NewScanTypeMap(loader *datasrc.Loader, r io.Reader) (ScanTypeMap, error)

NewScanTypeMap loads scan type map from io.Reader.

Jump to

Keyboard shortcuts

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