model_info_entity.go 3.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. // ==========================================================================
  2. // This is auto-generated by gf cli tool. You may not really want to edit it.
  3. // ==========================================================================
  4. package model_info
  5. import (
  6. "database/sql"
  7. "github.com/gogf/gf/database/gdb"
  8. )
  9. // Entity is the golang structure for table model_info.
  10. type Entity struct {
  11. ModelId uint `orm:"model_id,primary" json:"model_id"` // 模型ID
  12. ModelCategoryId uint `orm:"model_category_id" json:"model_category_id"` // 模板分类id
  13. ModelName string `orm:"model_name" json:"model_name"` // 模型标识
  14. ModelTitle string `orm:"model_title" json:"model_title"` // 模型名称
  15. ModelPk string `orm:"model_pk" json:"model_pk"` // 主键字段
  16. ModelOrder string `orm:"model_order" json:"model_order"` // 默认排序字段
  17. ModelSort string `orm:"model_sort" json:"model_sort"` // 表单字段排序
  18. ModelList string `orm:"model_list" json:"model_list"` // 列表显示字段,为空显示全部
  19. ModelEdit string `orm:"model_edit" json:"model_edit"` // 可编辑字段,为空则除主键外均可以编辑
  20. ModelIndexes string `orm:"model_indexes" json:"model_indexes"` // 索引字段
  21. SearchList string `orm:"search_list" json:"search_list"` // 高级搜索的字段
  22. CreateTime uint64 `orm:"create_time" json:"create_time"` // 创建时间
  23. UpdateTime uint64 `orm:"update_time" json:"update_time"` // 更新时间
  24. ModelStatus uint `orm:"model_status" json:"model_status"` // 状态
  25. ModelEngine string `orm:"model_engine" json:"model_engine"` // 数据库引擎
  26. CreateBy uint64 `orm:"create_by" json:"create_by"` // 创建人
  27. UpdateBy uint64 `orm:"update_by" json:"update_by"` // 修改人
  28. }
  29. // OmitEmpty sets OPTION_OMITEMPTY option for the model, which automatically filers
  30. // the data and where attributes for empty values.
  31. func (r *Entity) OmitEmpty() *arModel {
  32. return Model.Data(r).OmitEmpty()
  33. }
  34. // Inserts does "INSERT...INTO..." statement for inserting current object into table.
  35. func (r *Entity) Insert() (result sql.Result, err error) {
  36. return Model.Data(r).Insert()
  37. }
  38. // InsertIgnore does "INSERT IGNORE INTO ..." statement for inserting current object into table.
  39. func (r *Entity) InsertIgnore() (result sql.Result, err error) {
  40. return Model.Data(r).InsertIgnore()
  41. }
  42. // Replace does "REPLACE...INTO..." statement for inserting current object into table.
  43. // If there's already another same record in the table (it checks using primary key or unique index),
  44. // it deletes it and insert this one.
  45. func (r *Entity) Replace() (result sql.Result, err error) {
  46. return Model.Data(r).Replace()
  47. }
  48. // Save does "INSERT...INTO..." statement for inserting/updating current object into table.
  49. // It updates the record if there's already another same record in the table
  50. // (it checks using primary key or unique index).
  51. func (r *Entity) Save() (result sql.Result, err error) {
  52. return Model.Data(r).Save()
  53. }
  54. // Update does "UPDATE...WHERE..." statement for updating current object from table.
  55. // It updates the record if there's already another same record in the table
  56. // (it checks using primary key or unique index).
  57. func (r *Entity) Update() (result sql.Result, err error) {
  58. return Model.Data(r).Where(gdb.GetWhereConditionOfStruct(r)).Update()
  59. }
  60. // Delete does "DELETE FROM...WHERE..." statement for deleting current object from table.
  61. func (r *Entity) Delete() (result sql.Result, err error) {
  62. return Model.Where(gdb.GetWhereConditionOfStruct(r)).Delete()
  63. }