Ai
1 Star 0 Fork 435

xflash/go-admin

forked from go-admin/go-admin 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
posts.go 2.67 KB
一键复制 编辑 原始数据 按行查看 历史
honkui 提交于 2018-09-18 18:58 +08:00 . modify admin plugin table name;add make fmt command
package datamodel
import (
"github.com/chenhg5/go-admin/plugins/admin/models"
"github.com/chenhg5/go-admin/template/types"
)
func GetPostsTable() (postsTable models.Table) {
postsTable.Info.FieldList = []types.FieldStruct{
{
Head: "ID",
Field: "id",
TypeName: "int",
Sortable: true,
ExcuFun: func(model types.RowModel) interface{} {
return model.Value
},
},
{
Head: "Title",
Field: "title",
TypeName: "varchar",
Sortable: false,
ExcuFun: func(model types.RowModel) interface{} {
return model.Value
},
},
{
Head: "Description",
Field: "description",
TypeName: "varchar",
Sortable: false,
ExcuFun: func(model types.RowModel) interface{} {
return model.Value
},
},
{
Head: "Content",
Field: "content",
TypeName: "varchar",
Sortable: false,
ExcuFun: func(model types.RowModel) interface{} {
return model.Value
},
},
{
Head: "Date",
Field: "date",
TypeName: "varchar",
Sortable: false,
ExcuFun: func(model types.RowModel) interface{} {
return model.Value
},
},
}
postsTable.Info.Table = "posts"
postsTable.Info.Title = "Posts"
postsTable.Info.Description = "Posts"
postsTable.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: "Title",
Field: "title",
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: "Content",
Field: "content",
TypeName: "varchar",
Default: "",
Editable: true,
FormType: "text",
ExcuFun: func(model types.RowModel) interface{} {
return model.Value
},
}, {
Head: "Date",
Field: "date",
TypeName: "varchar",
Default: "",
Editable: true,
FormType: "text",
ExcuFun: func(model types.RowModel) interface{} {
return model.Value
},
},
}
postsTable.Form.Table = "posts"
postsTable.Form.Title = "Posts"
postsTable.Form.Description = "Posts"
postsTable.ConnectionDriver = "mysql"
return
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/xflash/go-admin.git
git@gitee.com:xflash/go-admin.git
xflash
go-admin
go-admin
v0.0.2

搜索帮助