template

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2021 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var OutputGormTemplate = parseTemplateOrPanic(`
///////////////////////////////////////////////////////////
// THIS FILE IS AUTO GENERATED by widgets, DON'T EDIT IT //
//        ANY CHANGES DONE HERE WILL BE LOST             //
///////////////////////////////////////////////////////////

package {{.PackageName}}

import (
	{{range .Imports}}
	"{{.}}"{{end}}
)

/**
 * @Author: BoolDesign
 * @Email: booldesign@163.com
 * @Date: {{.Date}}
 * @Desc:
 */

// {{.CamelTableName}} {{.Comment}}
type {{.CamelTableName}} struct {
	{{range .Fields}}
	{{.}}{{end}}
}

func ({{.CamelTableName}}) TableName() string {
	return "{{.TableName}}"
}

`)

Functions

func GenerateField

func GenerateField(field *FieldInfo) string

func GenerateFields

func GenerateFields(fields []*FieldInfo) []string

Types

type FieldInfo

type FieldInfo struct {
	Field     string // 驼峰字段名
	GormField string // 数据库字段名
	JsonField string // json字段名
	Type      string // 字段类型
	Key       string // 索引 PRI:主键
	Comment   string // 字段注释
}

type GormModelField

type GormModelField struct {
	PackageName    string   // 包名
	Imports        []string //引入包
	Date           string
	Comment        string   // struct注释
	CamelTableName string   // struct名(表名小驼峰)
	TableName      string   // 表名
	Fields         []string // struct字段
}

Jump to

Keyboard shortcuts

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