gen_model

package
v0.0.0-alpha Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2023 License: BSD-3-Clause Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Gen

func Gen(config gensc.GenModelConfig) error

生成协议

func QuoteChar

func QuoteChar() interface{}

Types

type Collection

type Collection struct {
	CollName             string // 表名
	StructName           string // 表名的驼峰格式
	PbStructName         string
	ArrStructName        string
	MongoDaoStructName   string // mongo dao 结构的名称
	RedisDaoStructName   string // redis dao 结构的名称
	Derive               string
	KeyArr               []string
	DataStructName       string
	FieldDict            map[string]*Field
	FieldArr             []*Field
	SecondaryKey         string
	CamelSecondaryKey    string
	CapCamelSecondaryKey string
	PrimaryKey           string
	CamelPrimaryKey      string
	CapCamelPrimaryKey   string
	PrimaryKeyField      *Field
	SecondaryKeyField    *Field
	IndexDict            map[string]*Index
	IndexArr             []*Index
	Capped               int64
	CommentArr           []string
}

func (*Collection) IsCapped

func (coll *Collection) IsCapped() bool

func (*Collection) IsDeriveUser

func (coll *Collection) IsDeriveUser() bool

func (*Collection) IsDeriveUserArr

func (coll *Collection) IsDeriveUserArr() bool

type Database

type Database struct {
	Module              string
	Driver              string
	ImportArr           []string
	DbStructName        string // 数据库名的驼峰格式
	MongoDaoStructName  string // mongo 的 dao 结构名字
	RedisDaoStructName  string // redis 的 dao 结构名字
	DbName              string
	GenBinFilePath      string        // 生成的文件路径,在 gen/model/{{DbName}}/bin/{{DbName}}.gen.go
	GenBinDir           string        // 生成的文件路径,在 gen/model/{{DbName}}/bin
	GenModelDir         string        // 生成的文件路径,在 gen/model/{{DbName}}
	GenModelFilePath    string        // 生成的文件路径,在 gen/model/{{DbName}}/{{DbName}}.gen.go
	GenProtobufFilePath string        // 生成的protobuf文件路径, 在gen/{{DbName}}/{{DbName}}.gen.proto
	CollectionArr       []*Collection // 所有的模型
	DaoInterfaceName    string
}

type Field

type Field struct {
	Tag              int
	Name             string
	CamelName        string
	Type             field_type
	Array            bool
	TypeName         string
	GoTypeName       string
	ProtobufTypeName string
	Default          interface{}
	CommentArr       []string
	Coll             *Collection
	IsPrimaryKey     bool /// 是否主键,目前只对userarr类型的表格有效果
	IsSecondaryKey   bool /// 是否次键,目前只对userarr类型的表格有效果
}

func (*Field) IsBool

func (f *Field) IsBool() bool

func (*Field) IsComparable

func (f *Field) IsComparable() bool

func (*Field) IsNumber

func (f *Field) IsNumber() bool

func (*Field) IsString

func (f *Field) IsString() bool

func (*Field) IsStruct

func (f *Field) IsStruct() bool

type Index

type Index struct {
	Name     string
	KeyDict  map[string]*Key
	KeyArr   []*Key
	Tag      int
	FullName string
	Unique   bool
}

type Key

type Key struct {
	Key   string
	Value interface{}
}

func (*Key) Val

func (k *Key) Val() interface{}

type Parser

type Parser interface {
	// contains filtered or unexported methods
}

Jump to

Keyboard shortcuts

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