base

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2022 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DealFilePath

func DealFilePath(s string, db string) (packageName, fileDir, fileName string)

DealFilePath back save path and package name

func JsonTag added in v1.2.0

func JsonTag(jsonType int, origin string) string

JsonTag deal tag by jsonType

func UpperCamel added in v1.3.0

func UpperCamel(s string) string

func Write

func Write(f FileInfo, data []StructInfo, oneFile bool)

Write struct information to .go file

Types

type Config

type Config struct {
	// file relative path
	SavePath string
	// json tag
	IsGenJsonTag bool
	// Generate one file or files by table
	IsGenInOneFile bool
	// Generate simple database field information like: "int unsigned not null"
	// value 1:not generate; 2:simple info
	GenDBInfoType int
	// json tag type. The necessary conditions:IsGenJsonTag:true.
	// 1.UserName 2.userName 3.user_name 4.user-name
	JsonTagType int
	// sql of creating table in database
	IsGenCreateSQL bool
	// custom type relationships will be preferred
	// the key is the database type, the value is the golang type
	CustomType map[string]string
}

Config config information

type FileInfo added in v1.2.0

type FileInfo struct {
	PackageName string
	FileDir     string
	FileName    string
}

type MysqlConfig

type MysqlConfig struct {
	User     string
	Password string
	Host     string
	Port     string
	// database name
	Database string
}

MysqlConfig mysql config information

type StructInfo added in v1.2.0

type StructInfo struct {
	Name          string
	TableName     string
	Note          string // description
	CreateSQL     string // create table sql
	StructContent string
}

Jump to

Keyboard shortcuts

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