templates

package
v0.0.0-...-9b971e3 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2022 License: Apache-2.0 Imports: 0 Imported by: 0

Documentation

Index

Constants

View Source
const ApiTemplate = `` /* 5288-byte string literal not displayed */
View Source
const EntityTemplate = `
package {{.packageName}}

import (
	"time"

	"gitee.com/chunanyong/zorm"
)

// {{.structName}}TableName 表名常量,方便直接调用
const {{.structName}}TableName = "{{.tableName}}"

// {{.structName}} {{.tableComment}}
type {{.structName}} struct {
	zorm.EntityStruct
	{{range $i, $v := .columns}}
    // {{$v.field}} {{$v.COLUMN_COMMENT}}
    {{$v.field}} {{$v.DATA_TYPE}} ` + "`" + `column:"{{$v.COLUMN_NAME}}"` + "`" + `
    {{end}}
	// * 数据库字段结束,以下是自定义字段 *

}

// GetTableName 获取表名称
func (entity *{{.structName}}) GetTableName() string {
	return {{.structName}}TableName
}

// GetPKColumnName 获取数据库表的主键字段名称
func (entity *{{.structName}}) GetPKColumnName() string {
	return "{{.pkName}}"
}
`
View Source
const LogicTemplate = `` /* 11990-byte string literal not displayed */
View Source
const ModelTemplate = `
package {{.modelPackageName}}

import (
	"time"

    "{{.coreName}}/types"
)

// {{.camelName}}Model {{.tableComment}}
type {{.camelName}}Model struct {
    types.ReqPageModel
	{{range $i, $v := .fields}}
    // {{$v.field}} {{$v.COLUMN_COMMENT}}
    {{$v.field}} {{$v.DATA_TYPE}} ` + "`" + `json:"{{$v.json}}"` + "`" + `
    {{end}}
}
`

Variables

This section is empty.

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

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