// ================================================================================= // 本文件由 GoFrame CLI 工具自动生成,可按需修改。 // ================================================================================= package table import ( "context" "github.com/gogf/gf/v2/database/gdb" ) // AdminOperationLog 定义表 "admin_operation_log" 的字段及其属性。 // 该映射由 GoFrame ORM 内部使用,用于理解表结构。 var AdminOperationLog = map[string]*gdb.TableField{ "id": { Index: 0, Name: "id", Type: "bigint unsigned", Null: false, Key: "PRI", Default: nil, Extra: "auto_increment", Comment: "", }, "admin_user_id": { Index: 1, Name: "admin_user_id", Type: "bigint unsigned", Null: false, Key: "MUL", Default: nil, Extra: "", Comment: "", }, "permission": { Index: 2, Name: "permission", Type: "varchar(128)", Null: false, Key: "MUL", Default: "", Extra: "", Comment: "", }, "method": { Index: 3, Name: "method", Type: "varchar(12)", Null: false, Key: "", Default: nil, Extra: "", Comment: "", }, "path": { Index: 4, Name: "path", Type: "varchar(255)", Null: false, Key: "", Default: nil, Extra: "", Comment: "", }, "ip": { Index: 5, Name: "ip", Type: "varchar(64)", Null: false, Key: "", Default: "", Extra: "", Comment: "", }, "request_param": { Index: 6, Name: "request_param", Type: "json", Null: true, Key: "", Default: nil, Extra: "", Comment: "", }, "duration_ms": { Index: 7, Name: "duration_ms", Type: "int unsigned", Null: false, Key: "", Default: "0", Extra: "", Comment: "", }, "status_code": { Index: 8, Name: "status_code", Type: "int", Null: false, Key: "", Default: "0", Extra: "", Comment: "", }, "created_at": { Index: 9, Name: "created_at", Type: "datetime", Null: false, Key: "", Default: nil, Extra: "", Comment: "", }, "updated_at": { Index: 10, Name: "updated_at", Type: "datetime", Null: false, Key: "", Default: nil, Extra: "", Comment: "", }, "deleted_at": { Index: 11, Name: "deleted_at", Type: "datetime", Null: true, Key: "MUL", Default: nil, Extra: "", Comment: "", }, } // AdminOperationLogTableFields 将表字段定义注册到数据库实例。 // db:实现 gdb.DB 接口的数据库实例。 // schema:可选的 schema/命名空间名,尤其适用于支持 schema 的数据库。 func SetAdminOperationLogTableFields(ctx context.Context, db gdb.DB, schema ...string) error { return db.GetCore().SetTableFields(ctx, "admin_operation_log", AdminOperationLog, schema...) }