create

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2024 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// 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 ModelGenLock = "__model__gen__.lock"

ModelGenLock the file is used to markup generated project

View Source
const ModelTpl = "__model__tpl__.go"

ModelTpl template file name

Variables

This section is empty.

Functions

func AddTableStructToTpl

func AddTableStructToTpl(cfg ConnConfig)

AddTableStructToTpl adds struct to tpl

func CreateProject

func CreateProject(force 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) Generator

func (p *Project) Generator(force bool)

func (Project) Parse

func (t Project) Parse() *tplInfo

func (Project) TypeImportString

func (t Project) TypeImportString() string

func (Project) TypesString

func (t Project) TypesString() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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