gen

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: May 12, 2024 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddMetadata

func AddMetadata(md *curdmodel.Metadata)

func AddTemplate

func AddTemplate(tpl *curdmodel.Template)

func CamelName

func CamelName(name string) string

func CamelName2

func CamelName2(name string) string

func CamelName3

func CamelName3(name string) string

func ConvertGoType

func ConvertGoType(f *curdmodel.MetadataField) string

func ConvertPBType

func ConvertPBType(f *curdmodel.MetadataField, isOnly int) string

func ConvertTSType

func ConvertTSType(f *curdmodel.MetadataField) string

func CreateMetadataByTable

func CreateMetadataByTable(sourceDB *gorm.DB, system, tableSchema, tableName string, isPostgres bool) *curdpb.MetadataInfo

func CreateMetadataByTableFromSqlServer

func CreateMetadataByTableFromSqlServer(sourceDB *gorm.DB, system, tableSchema, tableName string) *curdpb.MetadataInfo

func DeleteMetadata

func DeleteMetadata(id string)

func DeleteTemplate

func DeleteTemplate(id string)

func GenClassDefaultValue

func GenClassDefaultValue(f *curdmodel.MetadataField) stdtpl.HTML

func GenClassField

func GenClassField(f *curdmodel.MetadataField) stdtpl.HTML

func GenCode

func GenCode(tplID, mdID string) (string, error)

func GenCodeByFileTemplate

func GenCodeByFileTemplate(codeFile *curdmodel.FileTemplate, mdID string) (string, string, error)

func GenCodeByFunctionalTemplate

func GenCodeByFunctionalTemplate(functionalTemplate *curdmodel.FunctionalTemplate, mdID string, service *curdmodel.Service) ([]*apipb.GenFunctionalTemplateCodeInfo, error)

func GenCreateColumnSql

func GenCreateColumnSql(f *curdmodel.MetadataField) string

func GenCreateIndexsql

func GenCreateIndexsql(tableName string, f *curdmodel.MetadataField) string

func GenCreateSql

func GenCreateSql(md *curdmodel.Metadata) stdtpl.HTML

PRIMARY KEY (`id`),

KEY `idx_api_group` (`group`),
KEY `idx_api_method` (`method`),
KEY `idx_api_description` (`description`),
KEY `idx_api_enable` (`enable`),
KEY `idx_api_check_auth` (`check_auth`),
KEY `idx_api_deleted_at` (`deleted_at`),
KEY `idx_api_uri` (`path`),
KEY `idx_api_check_login` (`check_login`),
KEY `idx_api_path` (`path`)
UNIQUE KEY `unique_index` (`ptype`,`v0`,`v1`,`v2`,`v3`,`v4`,`v5`)

func GenCreateUniqueIndexsql

func GenCreateUniqueIndexsql(md *curdmodel.Metadata) string

func GenDeleteChildren

func GenDeleteChildren(md *curdmodel.Metadata) stdtpl.HTML

func GenDeleteChildren2

func GenDeleteChildren2(md *curdmodel.Metadata) stdtpl.HTML

func GenDeleteChildrenByParentID

func GenDeleteChildrenByParentID(md *curdmodel.Metadata) stdtpl.HTML

func GenDeleteChildrenByParentID2

func GenDeleteChildrenByParentID2(md *curdmodel.Metadata) stdtpl.HTML

func GenPBMessageProperty

func GenPBMessageProperty(index int, f *curdmodel.MetadataField, isOnly int) stdtpl.HTML

func GenPBQueryCond

func GenPBQueryCond(index int, f *curdmodel.MetadataField) stdtpl.HTML

func GenPBToStrcut

func GenPBToStrcut(f *curdmodel.MetadataField, str string) stdtpl.HTML

func GenPageConfig

func GenPageConfig(ctx *GenContext) stdtpl.HTML

func GenQueryCond

func GenQueryCond(f *curdmodel.MetadataField) stdtpl.HTML

func GenQueryStructField

func GenQueryStructField(f *curdmodel.MetadataField) stdtpl.HTML

func GenService

func GenService(serviceID string, writeFile bool, resp *apipb.GenServiceResponse)

func GenStrcutToPB

func GenStrcutToPB(f *curdmodel.MetadataField, str string) stdtpl.HTML

func GenStructField

func GenStructField(f *curdmodel.MetadataField) stdtpl.HTML

func GenSwagQueryParam

func GenSwagQueryParam(f *curdmodel.MetadataField) stdtpl.HTML

func GetDefaultValue

func GetDefaultValue(f *curdmodel.MetadataField) string

func GetMetadataById

func GetMetadataById(mdID string) (*curdmodel.Metadata, error)

func GetMetadataByName

func GetMetadataByName(name string) (*curdmodel.Metadata, error)

func GetTemplateById

func GetTemplateById(tplID string) (*curdmodel.Template, error)

func InitGenCode

func InitGenCode(md *curdmodel.Metadata)

func InitMetadata

func InitMetadata(db *gorm.DB, tableSchema string, isPostgres bool)

func InitMetadataFromSqlServer

func InitMetadataFromSqlServer(db db.DBClientInterface)

func JsonMarshal

func JsonMarshal(obj interface{}) string

func LcFirst

func LcFirst(s string) string

func LoadCache

func LoadCache()

func LowerSnakeCase

func LowerSnakeCase(s string) string

func RecursiveGetRefMetadatas

func RecursiveGetRefMetadatas(md *curdmodel.Metadata, mustChildren bool) []*curdmodel.Metadata

func RecursiveGetRefMetadatas2

func RecursiveGetRefMetadatas2(md *curdmodel.Metadata) []*curdmodel.Metadata

func RecursiveRefMetadata

func RecursiveRefMetadata(parentMD *curdmodel.Metadata, field *curdmodel.MetadataField, prefix string) []string

func RecursiveRefMetadatas

func RecursiveRefMetadatas(parentMD *curdmodel.Metadata, fields []*curdmodel.MetadataField, prefix string) []string

func RemoveLastChar

func RemoveLastChar(s string) string

func ToUpper

func ToUpper(str string) string

Types

type ColumnInfo

type ColumnInfo struct {
	TableSchema            string `gorm:"column(table_schema)"`
	TableName              string `gorm:"column(table_name)"`
	ColumnName             string `gorm:"column(column_name)"`
	ColumnDefault          string `gorm:"column(column_default)"`
	IsNullable             string `gorm:"column(is_nullable)"`
	DataType               string `gorm:"column(data_type)"`
	ColumnKey              string `gorm:"column(column_key)"`
	ColumnComment          string `gorm:"column(column_comment)"`
	CharacterMaximumLength string `gorm:"column(character_maximum_length)"`
}

type Config

type Config struct {
	APIs []ucpb.APIInfo
	Menu []ucpb.MenuInfo
}

func GenMenuConfig

func GenMenuConfig(service *curdmodel.Service, metadata *curdmodel.Metadata) Config

type GenContext

type GenContext struct {
	Metadata *curdmodel.Metadata
	Service  *curdmodel.Service
	CodeFile *curdmodel.CodeFile
	Template *curdmodel.Template
	Config   Config
}

type GenServiceRequest

type GenServiceRequest struct {
	ServiceID uint
}

type TableInfo

type TableInfo struct {
	TableName    string `gorm:"column(table_name)"`
	TableComment string `gorm:"column(table_comment)"`
}

Jump to

Keyboard shortcuts

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