create

package
v6.0.1+incompatible Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2019 License: Apache-2.0 Imports: 25 Imported by: 12

Documentation

Index

Constants

View Source
const (
	// API_PULL_ROUTER name of the interface used to register the pull route in the template
	API_PULL_ROUTER = "__API_PULL__"
	// API_PUSH_ROUTER name of the interface used to register the push route in the template
	API_PUSH_ROUTER = "__API_PUSH__"
	// MYSQL_MODEL name of the struct used to create mysql model
	MYSQL_MODEL = "__MYSQL_MODEL__"
	// MONGO_MODEL name of the struct used to create mongo model
	MONGO_MODEL = "__MONGO_MODEL__"
)
View Source
const MicroGenLock = "__tp-micro__gen__.lock"

MicroGenLock the file is used to markup generated project

View Source
const MicroTpl = "__tp-micro__tpl__.go"

MicroTpl template file name

Variables

This section is empty.

Functions

func AddTableStructToTpl

func AddTableStructToTpl(cfg ConnConfig)

AddTableStructToTpl adds struct to tpl

func CreateDoc

func CreateDoc()

CreateDoc creates a project doc.

func CreateProject

func CreateProject(force, newdoc bool)

CreateProject creates a project.

Types

type ConnConfig

type ConnConfig struct {
	MysqlConfig
	Tables  []string
	SshHost string
	SshPort string
	SshUser string
}

ConnConfig connection config

type Model

type Model struct {
	ModelStyle       string
	PrimaryFields    []*field
	UniqueFields     []*field
	Fields           []*field
	IsDefaultPrimary bool
	Doc              string
	Name             string
	SnakeName        string
	LowerFirstName   string
	LowerFirstLetter string
	NameSql          string
	QuerySql         [2]string
	UpdateSql        string
	UpsertSqlSuffix  string
	// contains filtered or unexported fields
}

func (Model) String

func (s Model) String() string

type MysqlConfig

type MysqlConfig struct {
	Host     string
	Port     string
	User     string
	Password string
	Db       string
}

MysqlConfig config

func (MysqlConfig) ConnString

func (c MysqlConfig) ConnString() string

ConnString returns the connection string.

type Project

type Project struct {
	Name         string
	ImprotPrefix string
	// contains filtered or unexported fields
}

Project project Information

func NewProject

func NewProject(src []byte) *Project

NewProject new project.

func (Project) CallHandlerList

func (t Project) CallHandlerList() []*handler

func (Project) CallHandlerString

func (t Project) CallHandlerString(ctnFn func(*handler) string) string

func (*Project) Generator

func (p *Project) Generator(force, newdoc bool)

func (Project) HandlerList

func (t Project) HandlerList() []*handler

func (Project) Parse

func (t Project) Parse() *tplInfo

func (Project) PushHandlerList

func (t Project) PushHandlerList() []*handler

func (Project) PushHandlerString

func (t Project) PushHandlerString(ctnFn func(*handler) string) string

func (Project) RouterString

func (t Project) RouterString(groupName string) string

func (Project) TypeImportString

func (t Project) TypeImportString() string

func (Project) TypesString

func (t Project) TypesString() string

Directories

Path Synopsis
tpl

Jump to

Keyboard shortcuts

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