gendao

package
v2.7.0 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2024 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CGenDaoConfig = `gfcli.gen.dao`
	CGenDaoUsage  = `gf gen dao [OPTION]`
	CGenDaoBrief  = `automatically generate go files for dao/do/entity`
	CGenDaoEg     = `` /* 161-byte string literal not displayed */

	CGenDaoAd = `` /* 703-byte string literal not displayed */

	CGenDaoBriefPath              = `directory path for generated files`
	CGenDaoBriefLink              = `database configuration, the same as the ORM configuration of GoFrame`
	CGenDaoBriefTables            = `generate models only for given tables, multiple table names separated with ','`
	CGenDaoBriefTablesEx          = `generate models excluding given tables, multiple table names separated with ','`
	CGenDaoBriefPrefix            = `add prefix for all table of specified link/database tables`
	CGenDaoBriefRemovePrefix      = `remove specified prefix of the table, multiple prefix separated with ','`
	CGenDaoBriefRemoveFieldPrefix = `remove specified prefix of the field, multiple prefix separated with ','`
	CGenDaoBriefStdTime           = `use time.Time from stdlib instead of gtime.Time for generated time/date fields of tables`
	CGenDaoBriefWithTime          = `add created time for auto produced go files`
	CGenDaoBriefGJsonSupport      = `use gJsonSupport to use *gjson.Json instead of string for generated json fields of tables`
	CGenDaoBriefImportPrefix      = `custom import prefix for generated go files`
	CGenDaoBriefDaoPath           = `directory path for storing generated dao files under path`
	CGenDaoBriefDoPath            = `directory path for storing generated do files under path`
	CGenDaoBriefEntityPath        = `directory path for storing generated entity files under path`
	CGenDaoBriefOverwriteDao      = `overwrite all dao files both inside/outside internal folder`
	CGenDaoBriefModelFile         = `custom file name for storing generated model content`
	CGenDaoBriefModelFileForDao   = `custom file name generating model for DAO operations like Where/Data. It's empty in default`
	CGenDaoBriefDescriptionTag    = `add comment to description tag for each field`
	CGenDaoBriefNoJsonTag         = `no json tag will be added for each field`
	CGenDaoBriefNoModelComment    = `no model comment will be added for each field`
	CGenDaoBriefClear             = `delete all generated go files that do not exist in database`
	CGenDaoBriefTypeMapping       = `custom local type mapping for generated struct attributes relevant to fields of table`
	CGenDaoBriefGroup             = `` /* 135-byte string literal not displayed */

	CGenDaoBriefJsonCase = `` /* 442-byte string literal not displayed */

	CGenDaoBriefTplDaoIndexPath    = `template file path for dao index file`
	CGenDaoBriefTplDaoInternalPath = `template file path for dao internal file`
	CGenDaoBriefTplDaoDoPathPath   = `template file path for dao do file`
	CGenDaoBriefTplDaoEntityPath   = `template file path for dao entity file`
)

Variables

This section is empty.

Functions

This section is empty.

Types

type CGenDao

type CGenDao struct{}

func (CGenDao) Dao

func (c CGenDao) Dao(ctx context.Context, in CGenDaoInput) (out *CGenDaoOutput, err error)

type CGenDaoInput

type CGenDaoInput struct {
	g.Meta             `name:"dao" config:"{CGenDaoConfig}" usage:"{CGenDaoUsage}" brief:"{CGenDaoBrief}" eg:"{CGenDaoEg}" ad:"{CGenDaoAd}"`
	Path               string `name:"path"                short:"p"  brief:"{CGenDaoBriefPath}" d:"internal"`
	Link               string `name:"link"                short:"l"  brief:"{CGenDaoBriefLink}"`
	Tables             string `name:"tables"              short:"t"  brief:"{CGenDaoBriefTables}"`
	TablesEx           string `name:"tablesEx"            short:"x"  brief:"{CGenDaoBriefTablesEx}"`
	Group              string `name:"group"               short:"g"  brief:"{CGenDaoBriefGroup}" d:"default"`
	Prefix             string `name:"prefix"              short:"f"  brief:"{CGenDaoBriefPrefix}"`
	RemovePrefix       string `name:"removePrefix"        short:"r"  brief:"{CGenDaoBriefRemovePrefix}"`
	RemoveFieldPrefix  string `name:"removeFieldPrefix"   short:"rf" brief:"{CGenDaoBriefRemoveFieldPrefix}"`
	JsonCase           string `name:"jsonCase"            short:"j"  brief:"{CGenDaoBriefJsonCase}" d:"CamelLower"`
	ImportPrefix       string `name:"importPrefix"        short:"i"  brief:"{CGenDaoBriefImportPrefix}"`
	DaoPath            string `name:"daoPath"             short:"d"  brief:"{CGenDaoBriefDaoPath}" d:"dao"`
	DoPath             string `name:"doPath"              short:"o"  brief:"{CGenDaoBriefDoPath}" d:"model/do"`
	EntityPath         string `name:"entityPath"          short:"e"  brief:"{CGenDaoBriefEntityPath}" d:"model/entity"`
	TplDaoIndexPath    string `name:"tplDaoIndexPath"     short:"t1" brief:"{CGenDaoBriefTplDaoIndexPath}"`
	TplDaoInternalPath string `name:"tplDaoInternalPath"  short:"t2" brief:"{CGenDaoBriefTplDaoInternalPath}"`
	TplDaoDoPath       string `name:"tplDaoDoPath"        short:"t3" brief:"{CGenDaoBriefTplDaoDoPathPath}"`
	TplDaoEntityPath   string `name:"tplDaoEntityPath"    short:"t4" brief:"{CGenDaoBriefTplDaoEntityPath}"`
	StdTime            bool   `name:"stdTime"             short:"s"  brief:"{CGenDaoBriefStdTime}" orphan:"true"`
	WithTime           bool   `name:"withTime"            short:"w"  brief:"{CGenDaoBriefWithTime}" orphan:"true"`
	GJsonSupport       bool   `name:"gJsonSupport"        short:"n"  brief:"{CGenDaoBriefGJsonSupport}" orphan:"true"`
	OverwriteDao       bool   `name:"overwriteDao"        short:"v"  brief:"{CGenDaoBriefOverwriteDao}" orphan:"true"`
	DescriptionTag     bool   `name:"descriptionTag"      short:"c"  brief:"{CGenDaoBriefDescriptionTag}" orphan:"true"`
	NoJsonTag          bool   `name:"noJsonTag"           short:"k"  brief:"{CGenDaoBriefNoJsonTag}" orphan:"true"`
	NoModelComment     bool   `name:"noModelComment"      short:"m"  brief:"{CGenDaoBriefNoModelComment}" orphan:"true"`
	Clear              bool   `name:"clear"               short:"a"  brief:"{CGenDaoBriefClear}" orphan:"true"`

	TypeMapping map[DBFieldTypeName]CustomAttributeType `name:"typeMapping" short:"y" brief:"{CGenDaoBriefTypeMapping}" orphan:"true"`
	// contains filtered or unexported fields
}

type CGenDaoInternalGenItem added in v2.6.4

type CGenDaoInternalGenItem struct {
	Clear              bool
	StorageDirPaths    []string
	GeneratedFilePaths []string
}

type CGenDaoInternalGenItems added in v2.6.4

type CGenDaoInternalGenItems struct {
	Items []CGenDaoInternalGenItem
	// contains filtered or unexported fields
}

func (CGenDaoInternalGenItems) AppendDirPath added in v2.6.4

func (i CGenDaoInternalGenItems) AppendDirPath(storageDirPath string)

func (CGenDaoInternalGenItems) AppendGeneratedFilePath added in v2.6.4

func (i CGenDaoInternalGenItems) AppendGeneratedFilePath(generatedFilePath string)

func (*CGenDaoInternalGenItems) Scale added in v2.6.4

func (i *CGenDaoInternalGenItems) Scale()

func (*CGenDaoInternalGenItems) SetClear added in v2.6.4

func (i *CGenDaoInternalGenItems) SetClear(clear bool)

type CGenDaoInternalInput

type CGenDaoInternalInput struct {
	CGenDaoInput
	DB            gdb.DB
	TableNames    []string
	NewTableNames []string
}

type CGenDaoOutput

type CGenDaoOutput struct{}

type CustomAttributeType

type CustomAttributeType struct {
	Type   string `brief:"custom attribute type name"`
	Import string `brief:"custom import for this type"`
}

type DBFieldTypeName

type DBFieldTypeName = string

Jump to

Keyboard shortcuts

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