mongodb

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	F_STRING   = "string"
	F_INT      = "int64"
	F_BOOL     = "bool"
	F_FLOAT    = "float64"
	F_TIME     = "time.Time"
	F_A_INT    = "[]int64"
	F_A_FLOAT  = "[]float64"
	F_A_STRING = "[]string"
	F_O2M      = "[]*"
	F_O2O      = "*"
	F_MAP      = "bson.M"
	F_A_MAP    = "[]bson.M"
)

Variables

This section is empty.

Functions

func CreateController

func CreateController(c *Creator)

func CreateCrud

func CreateCrud(creator *Creator)

func CreateDocument

func CreateDocument(creator *Creator)

func CreateEmptyController

func CreateEmptyController(c *Creator)

func CreateNestedDocument

func CreateNestedDocument(creator *Creator) string

func CreateVueAdminFile

func CreateVueAdminFile(creator *Creator)

func Init

func Init(c *Creator)

func ReadTpl

func ReadTpl(fileName string) string

func SetRoot added in v1.0.1

func SetRoot(rt string)

func SetTwig

func SetTwig(tg *twig.Twig)

Types

type Creator

type Creator struct {
	AppName        string     `json:"appName"`
	Table          *Table     `json:"table"`
	Fields         []*Field   `json:"fields"`
	RelationTables []*Creator `json:"relationTables"`
}

func NewDocument

func NewDocument(name string, cnName string, path string) *Creator

func (*Creator) Add

func (c *Creator) Add(name string, label string) *Field

func (*Creator) AddDocument

func (c *Creator) AddDocument(name string, cnName string, function func(subDoc *Creator) *Creator) *Creator

func (*Creator) Generate

func (c *Creator) Generate()

func (*Creator) GetTable

func (c *Creator) GetTable() *Table

func (*Creator) SetCnName

func (c *Creator) SetCnName(cnName string) *Table

func (*Creator) SetName

func (c *Creator) SetName(name string) *Table

func (*Creator) SetPath

func (c *Creator) SetPath(path string) *Table

type Field

type Field struct {
	Name   string
	CnName string
	ReName string
	Type   string
	Src    string
}

func (*Field) CreateConfig

func (this *Field) CreateConfig() *Field

func (*Field) GetCnName

func (this *Field) GetCnName() string

func (*Field) GetConfig

func (this *Field) GetConfig() *Field

func (*Field) GetName

func (this *Field) GetName() string

func (*Field) GetReName

func (this *Field) GetReName() string

func (*Field) GetSrc

func (this *Field) GetSrc() string

func (*Field) GetType

func (this *Field) GetType() string

func (*Field) IsArrayFloat

func (this *Field) IsArrayFloat() *Field

func (*Field) IsArrayInt

func (this *Field) IsArrayInt() *Field

func (*Field) IsArrayMap

func (this *Field) IsArrayMap() *Field

func (*Field) IsArrayString

func (this *Field) IsArrayString() *Field

func (*Field) IsBool

func (this *Field) IsBool() *Field

func (*Field) IsFloat

func (this *Field) IsFloat() *Field

func (*Field) IsInt

func (this *Field) IsInt() *Field

func (*Field) IsMap

func (this *Field) IsMap() *Field

func (*Field) IsO20

func (this *Field) IsO20() *Field

func (*Field) IsO2M

func (this *Field) IsO2M() *Field

func (*Field) IsString

func (this *Field) IsString() *Field

func (*Field) IsTime

func (this *Field) IsTime() *Field

func (*Field) SetCnName

func (this *Field) SetCnName(v string) *Field

func (*Field) SetName

func (this *Field) SetName(v string) *Field

func (*Field) SetReName

func (this *Field) SetReName(v string) *Field

func (*Field) SetSrc

func (this *Field) SetSrc(v string) *Field

func (*Field) SetType

func (this *Field) SetType(v string) *Field

type OrmField

type OrmField struct {
	Name string
	Type string
	Tags string
}

**************************Model创建********************************

type Table

type Table struct {
	Name   string   `json:"name" groups:"app" orm:"null;description(数据表);on_delete(set_null);size(255);"`
	CnName string   `json:"cnName" groups:"app" orm:"null;description(中文名称);on_delete(set_null);size(255);"`
	Path   string   `json:"path" groups:"app" orm:"null;description(实体路径);on_delete(set_null);size(255);"`
	Fields []*Field `json:"fields" groups:"app" orm:"null;description(字段集);on_delete(set_null);reverse(many);"`
}

Jump to

Keyboard shortcuts

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