base

package
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2022 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CodeJsonTag1 = 1 + iota
	CodeJsonTag2
	CodeJsonTag3
	CodeJsonTag4
)
View Source
const (
	CodeDBInfoNone = 1 + iota
	CodeDBInfoSimple
	CodeDBInfoGorm
	CodeDBInfoXorm
)

Variables

This section is empty.

Functions

func CamelCase

func CamelCase(str string) string

CamelCase 修改为大写开头的驼峰格式

func DealFilePath

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

DealFilePath 处理保存路径,包名和文件名

func Next

func Next(depth int) string

Next 换行

func Tab

func Tab(depth int) string

Tab 缩进

func Write

func Write(packageName, fileDir, fileName string, content map[string]string, oneFile bool)

Write 结构体信息写入go文件

Types

type Config

type Config struct {
	//文件名,默认[数据库].go,使用相对路径
	SavePath string
	//Table   []string todo
	IsGenJsonTag bool
	//生成在同一个文件中
	IsGenInOneFile bool
	//生成数据库字段信息  1.不生产 2.普通字段信息 3.gorm 4.xorm
	GenDBInfoType int
	//jsonTag类型 1.UserName 2.user_name 3.userName 4.user-name
	JsonTagType int
}

Config 配置文件

type MysqlConfig

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

MysqlConfig mysql配置

Jump to

Keyboard shortcuts

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