genstruct

package
v0.0.0-...-ebf66af Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2021 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GenElement

type GenElement struct {
	Name       string              // Name.元素名
	ColumnName string              // table name.表名
	Type       string              // Type.类型标记
	Notes      string              // Notes.注释
	Tags       map[string][]string // tages.标记
}

GenElement element of sturct.元素类

func (*GenElement) AddTag

func (e *GenElement) AddTag(k string, v string)

AddTag Add a tag .添加一个tag标记

func (*GenElement) Generate

func (e *GenElement) Generate() string

Generate Get the result data.获取结果数据

func (*GenElement) GenerateColor

func (e *GenElement) GenerateColor() string

GenerateColor Get the result data.获取结果数据

func (*GenElement) SetName

func (e *GenElement) SetName(name string)

SetName Setting element name.设置元素名字

func (*GenElement) SetNotes

func (e *GenElement) SetNotes(notes string)

SetNotes Setting element notes.设置注释

func (*GenElement) SetType

func (e *GenElement) SetType(tp string)

SetType Setting element type.设置元素类型

type GenPackage

type GenPackage struct {
	Name        string            // name.名字
	Imports     map[string]string // Inclusion term.元素组合
	Structs     []GenStruct       // struct list .结构体组合
	FuncStrList []string          // func of template on string. 函数的最终定义
}

GenPackage package of IPackage.包体

func (*GenPackage) AddFuncStr

func (p *GenPackage) AddFuncStr(src string)

AddFuncStr add func coding string.添加函数串

func (*GenPackage) AddImport

func (p *GenPackage) AddImport(imp string)

AddImport Add import by type.通过类型添加import

func (*GenPackage) AddStruct

func (p *GenPackage) AddStruct(st GenStruct)

AddStruct Add a structure.添加一个结构体

func (*GenPackage) Generate

func (p *GenPackage) Generate() string

Generate Get the result data.获取结果数据

func (*GenPackage) SetPackage

func (p *GenPackage) SetPackage(pname string)

SetPackage Defining package names.定义包名

type GenStruct

type GenStruct struct {
	SQLBuildStr string       // Create SQL statements.创建sql语句
	TableName   string       // table_name.表名
	Name        string       // name.名字
	Notes       string       // notes.注释
	Em          []GenElement // em.元素组合
}

GenStruct struct of IStruct .结构体

func (*GenStruct) AddElement

func (s *GenStruct) AddElement(e ...GenElement)

AddElement Add one or more elements.添加一个/或多个元素

func (*GenStruct) GenerateColumnName

func (s *GenStruct) GenerateColumnName() []string

GenerateColumnName generate column name . 生成列名

func (*GenStruct) GenerateTableName

func (s *GenStruct) GenerateTableName() []string

GenerateTableName generate table name .生成表名

func (*GenStruct) Generates

func (s *GenStruct) Generates() []string

Generates Get the result data.获取结果数据

func (*GenStruct) GeneratesColor

func (s *GenStruct) GeneratesColor() []string

\033[3%d;%dm -%d;%d-colors!\033[0m\n GeneratesColor Get the result data on color.获取结果数据 带颜色

func (*GenStruct) SetCreatTableStr

func (s *GenStruct) SetCreatTableStr(sql string)

SetCreatTableStr Set up SQL create statement, backup use setup create statement, backup use.设置创建语句,备份使用

func (*GenStruct) SetNotes

func (s *GenStruct) SetNotes(notes string)

SetNotes set the notes.设置注释

func (*GenStruct) SetStructName

func (s *GenStruct) SetStructName(name string)

SetStructName Setting the name of struct.设置struct名字

func (*GenStruct) SetTableName

func (s *GenStruct) SetTableName(name string)

SetTableName Setting the name of struct.设置struct名字

Jump to

Keyboard shortcuts

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