generator

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2017 License: MIT Imports: 8 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var NullMap = map[string]string{
	"int":    "sql.NullInt64",
	"string": "sql.NullString",
	"float":  "sql.NullFloat64",
	"bool":   "sql.NullBool",
}

NullMap is map that relates MySQL's null to Go's null(database/sql)

View Source
var TypeMap = map[string]string{
	"tinyint(1)":   "bool",
	"int*unsigned": "uint",
	"int":          "int",
	"float":        "float64",
	"varchar":      "string",
	"text":         "string",
	"datetime":     "time.Time",
	"timestamp":    "time.Time",
	"date":         "time.Time",
}

TypeMap is map that relates MySQL's type to Go's type

Functions

func FormatDAOName added in v1.1.0

func FormatDAOName(daoName string) (result string)

func FormatInitialisms added in v1.1.0

func FormatInitialisms(s string) string

FormatInitialisms returns string formated by common initialisms

func ToCamelCaseFromSnakeCase added in v1.1.0

func ToCamelCaseFromSnakeCase(s string) string

Types

type Generator

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

Generator has buffer of source code

func (*Generator) Format

func (g *Generator) Format() []byte

Format makes code formated by go-fmt

func (*Generator) GenerateDAO added in v1.1.0

func (g *Generator) GenerateDAO(column repository.Column)

GenerateDAO makes a part of import packages and dao struct.

func (*Generator) GenerateHead

func (g *Generator) GenerateHead(packageName string)

GenerateHead makes common header

func (*Generator) GenerateMISC added in v1.1.0

func (g *Generator) GenerateMISC(daoList []string)

GenerateMISC makes miscellaneous functions.

func (*Generator) Print added in v1.1.0

func (g *Generator) Print(s string)

Print puts data in generator's buffer

func (*Generator) Printf

func (g *Generator) Printf(format string, args ...interface{})

Printf puts data in generator's buffer

Jump to

Keyboard shortcuts

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