t2go

package
v0.0.0-...-36972ea Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2021 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func T2GO

func T2GO(dns, tableName string) (content string, err error)

表结构转换工具

Types

type T2tConfig

type T2tConfig struct {
	StructNameToHump bool // 结构体名称是否转为驼峰式,默认为false
	RmTagIfUcFirsted bool // 如果字段首字母本来就是大写, 就不添加tag, 默认false添加, true不添加
	TagToLower       bool // tag的字段名字是否转换为小写, 如果本身有大写字母的话, 默认false不转
	JsonTagToHump    bool // json tag是否转为驼峰,默认为false,不转换
	UcFirstOnly      bool // 字段首字母大写的同时, 是否要把其他字母转换为小写,默认false不转换
	SeperatFile      bool // 每个struct放入单独的文件,默认false,放入同一个文件
}

type Table2Struct

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

func NewTable2Struct

func NewTable2Struct() *Table2Struct

func (*Table2Struct) Config

func (t *Table2Struct) Config(c *T2tConfig) *Table2Struct

func (*Table2Struct) DB

func (t *Table2Struct) DB(d *sql.DB) *Table2Struct

func (*Table2Struct) DateToTime

func (t *Table2Struct) DateToTime(d bool) *Table2Struct

func (*Table2Struct) Dsn

func (t *Table2Struct) Dsn(d string) *Table2Struct

func (*Table2Struct) EnableJsonTag

func (t *Table2Struct) EnableJsonTag(p bool) *Table2Struct

func (*Table2Struct) PackageName

func (t *Table2Struct) PackageName(r string) *Table2Struct

func (*Table2Struct) Prefix

func (t *Table2Struct) Prefix(p string) *Table2Struct

func (*Table2Struct) RealNameMethod

func (t *Table2Struct) RealNameMethod(r string) *Table2Struct

func (*Table2Struct) Run

func (t *Table2Struct) Run() (content string, err error)

直接输出struct

func (*Table2Struct) RunToFile

func (t *Table2Struct) RunToFile() error

写入到文件

func (*Table2Struct) SavePath

func (t *Table2Struct) SavePath(p string) *Table2Struct

func (*Table2Struct) Table

func (t *Table2Struct) Table(tab string) *Table2Struct

func (*Table2Struct) TagKey

func (t *Table2Struct) TagKey(r string) *Table2Struct

Jump to

Keyboard shortcuts

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