role_entity.go 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. // ==========================================================================
  2. // This is auto-generated by gf cli tool. You may not really want to edit it.
  3. // ==========================================================================
  4. package role
  5. import (
  6. "database/sql"
  7. "github.com/gogf/gf/database/gdb"
  8. )
  9. // Entity is the golang structure for table role.
  10. type Entity struct {
  11. Id uint `orm:"id,primary" json:"id"` //
  12. Status uint `orm:"status" json:"status"` // 状态;0:禁用;1:正常
  13. CreateTime uint `orm:"create_time" json:"create_time"` // 创建时间
  14. UpdateTime uint `orm:"update_time" json:"update_time"` // 更新时间
  15. ListOrder float64 `orm:"list_order" json:"list_order"` // 排序
  16. Name string `orm:"name" json:"name"` // 角色名称
  17. Remark string `orm:"remark" json:"remark"` // 备注
  18. DataScope uint `orm:"data_scope" json:"data_scope"` // 数据范围(1:全部数据权限 2:自定数据权限 3:本部门数据权限 4:本部门及以下数据权限)
  19. }
  20. // OmitEmpty sets OPTION_OMITEMPTY option for the model, which automatically filers
  21. // the data and where attributes for empty values.
  22. func (r *Entity) OmitEmpty() *arModel {
  23. return Model.Data(r).OmitEmpty()
  24. }
  25. // Inserts does "INSERT...INTO..." statement for inserting current object into table.
  26. func (r *Entity) Insert() (result sql.Result, err error) {
  27. return Model.Data(r).Insert()
  28. }
  29. // InsertIgnore does "INSERT IGNORE INTO ..." statement for inserting current object into table.
  30. func (r *Entity) InsertIgnore() (result sql.Result, err error) {
  31. return Model.Data(r).InsertIgnore()
  32. }
  33. // Replace does "REPLACE...INTO..." statement for inserting current object into table.
  34. // If there's already another same record in the table (it checks using primary key or unique index),
  35. // it deletes it and insert this one.
  36. func (r *Entity) Replace() (result sql.Result, err error) {
  37. return Model.Data(r).Replace()
  38. }
  39. // Save does "INSERT...INTO..." statement for inserting/updating current object into table.
  40. // It updates the record if there's already another same record in the table
  41. // (it checks using primary key or unique index).
  42. func (r *Entity) Save() (result sql.Result, err error) {
  43. return Model.Data(r).Save()
  44. }
  45. // Update does "UPDATE...WHERE..." statement for updating current object from table.
  46. // It updates the record if there's already another same record in the table
  47. // (it checks using primary key or unique index).
  48. func (r *Entity) Update() (result sql.Result, err error) {
  49. return Model.Data(r).Where(gdb.GetWhereConditionOfStruct(r)).Update()
  50. }
  51. // Delete does "DELETE FROM...WHERE..." statement for deleting current object from table.
  52. func (r *Entity) Delete() (result sql.Result, err error) {
  53. return Model.Where(gdb.GetWhereConditionOfStruct(r)).Delete()
  54. }