1 Star 0 Fork 401

xflash / go-admin

forked from go-admin / go-admin 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
authors.go 3.12 KB
AI 代码解读
一键复制 编辑 原始数据 按行查看 历史
package datamodel
import (
"github.com/chenhg5/go-admin/plugins/admin/models"
"github.com/chenhg5/go-admin/template/types"
)
func GetAuthorsTable() (authorsTable models.Table) {
authorsTable.Info.FieldList = []types.FieldStruct{
{
Head: "ID",
Field: "id",
TypeName: "int",
Sortable: true,
ExcuFun: func(model types.RowModel) interface{} {
return model.Value
},
},
{
Head: "First Name",
Field: "first_name",
TypeName: "varchar",
Sortable: false,
ExcuFun: func(model types.RowModel) interface{} {
return model.Value
},
},
{
Head: "Last Name",
Field: "last_name",
TypeName: "varchar",
Sortable: false,
ExcuFun: func(model types.RowModel) interface{} {
return model.Value
},
},
{
Head: "Email",
Field: "email",
TypeName: "varchar",
Sortable: false,
ExcuFun: func(model types.RowModel) interface{} {
return model.Value
},
},
{
Head: "Birthdate",
Field: "birthdate",
TypeName: "date",
Sortable: false,
ExcuFun: func(model types.RowModel) interface{} {
return model.Value
},
},
{
Head: "Added",
Field: "added",
TypeName: "timestamp",
Sortable: false,
ExcuFun: func(model types.RowModel) interface{} {
return model.Value
},
},
}
authorsTable.Info.Table = "authors"
authorsTable.Info.Title = "Authors"
authorsTable.Info.Description = "Authors"
authorsTable.Form.FormList = []types.FormStruct{
{
Head: "ID",
Field: "id",
TypeName: "int",
Default: "",
Editable: false,
FormType: "default",
ExcuFun: func(model types.RowModel) interface{} {
return model.Value
},
}, {
Head: "First Name",
Field: "first_name",
TypeName: "varchar",
Default: "",
Editable: true,
FormType: "text",
ExcuFun: func(model types.RowModel) interface{} {
return model.Value
},
}, {
Head: "Name",
Field: "name",
TypeName: "varchar",
Default: "",
Editable: true,
FormType: "text",
ExcuFun: func(model types.RowModel) interface{} {
return model.Value
},
}, {
Head: "Description",
Field: "description",
TypeName: "varchar",
Default: "",
Editable: true,
FormType: "text",
ExcuFun: func(model types.RowModel) interface{} {
return model.Value
},
}, {
Head: "Email",
Field: "email",
TypeName: "varchar",
Default: "",
Editable: true,
FormType: "text",
ExcuFun: func(model types.RowModel) interface{} {
return model.Value
},
}, {
Head: "Birthdate",
Field: "birthdate",
TypeName: "date",
Default: "",
Editable: true,
FormType: "text",
ExcuFun: func(model types.RowModel) interface{} {
return model.Value
},
}, {
Head: "Added",
Field: "added",
TypeName: "timestamp",
Default: "",
Editable: true,
FormType: "text",
ExcuFun: func(model types.RowModel) interface{} {
return model.Value
},
},
}
authorsTable.Form.Table = "authors"
authorsTable.Form.Title = "Authors"
authorsTable.Form.Description = "Authors"
authorsTable.ConnectionDriver = "mysql"
return
}
Go
1
https://gitee.com/xflash/go-admin.git
git@gitee.com:xflash/go-admin.git
xflash
go-admin
go-admin
v0.0.2

搜索帮助