35 lines
1.4 KiB
Go
35 lines
1.4 KiB
Go
// Copyright GoFrame gf Author(https://goframe.org). All Rights Reserved.
|
|
//
|
|
// This Source Code Form is subject to the terms of the MIT License.
|
|
// If a copy of the MIT was not distributed with this file,
|
|
// You can obtain one at https://github.com/gogf/gf.
|
|
|
|
package consts
|
|
|
|
const TemplateGenTableContent = `
|
|
// =================================================================================
|
|
// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed.
|
|
// =================================================================================
|
|
|
|
package {{.TplPackageName}}
|
|
|
|
import (
|
|
"context"
|
|
"git.magicany.cc/black1552/gin-base/database"
|
|
)
|
|
|
|
// {{.TplTableNameCamelCase}} defines the fields of table "{{.TplTableName}}" with their properties.
|
|
// This map is used internally by GoFrame ORM to understand table structure.
|
|
var {{.TplTableNameCamelCase}} = map[string]*database.TableField{
|
|
{{.TplTableFields}}
|
|
}
|
|
|
|
// Set{{.TplTableNameCamelCase}}TableFields registers the table fields definition to the database instance.
|
|
// db: database instance that implements gdb.DB interface.
|
|
// schema: optional schema/namespace name, especially for databases that support schemas.
|
|
func Set{{.TplTableNameCamelCase}}TableFields(ctx context.Context, db database.DB, schema ...string) error {
|
|
return db.GetCore().SetTableFields(ctx, "{{.TplTableName}}", {{.TplTableNameCamelCase}}, schema...)
|
|
}
|
|
|
|
`
|