role_entity.go 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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 int `orm:"id,primary" json:"id"` //
  12. Status int `orm:"status" json:"status"` // 状态;0:禁用;1:正常
  13. CreateTime int `orm:"create_time" json:"create_time"` // 创建时间
  14. UpdateTime int `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 int `orm:"data_scope" json:"data_scope"` // 数据范围(1:全部数据权限 2:自定数据权限 3:本部门数据权限 4:本部门及以下数据权限)
  19. }
  20. // Role is alias of Entity, which some developers say they just want.
  21. type Role = Entity
  22. // OmitEmpty sets OPTION_OMITEMPTY option for the model, which automatically filers
  23. // the data and where attributes for empty values.
  24. func (r *Entity) OmitEmpty() *arModel {
  25. return Model.Data(r).OmitEmpty()
  26. }
  27. // Inserts does "INSERT...INTO..." statement for inserting current object into table.
  28. func (r *Entity) Insert() (result sql.Result, err error) {
  29. return Model.Data(r).Insert()
  30. }
  31. // Replace does "REPLACE...INTO..." statement for inserting current object into table.
  32. // If there's already another same record in the table (it checks using primary key or unique index),
  33. // it deletes it and insert this one.
  34. func (r *Entity) Replace() (result sql.Result, err error) {
  35. return Model.Data(r).Replace()
  36. }
  37. // Save does "INSERT...INTO..." statement for inserting/updating current object into table.
  38. // It updates the record if there's already another same record in the table
  39. // (it checks using primary key or unique index).
  40. func (r *Entity) Save() (result sql.Result, err error) {
  41. return Model.Data(r).Save()
  42. }
  43. // Update does "UPDATE...WHERE..." statement for updating current object from table.
  44. // It updates the record if there's already another same record in the table
  45. // (it checks using primary key or unique index).
  46. func (r *Entity) Update() (result sql.Result, err error) {
  47. return Model.Data(r).Where(gdb.GetWhereConditionOfStruct(r)).Update()
  48. }
  49. // Delete does "DELETE FROM...WHERE..." statement for deleting current object from table.
  50. func (r *Entity) Delete() (result sql.Result, err error) {
  51. return Model.Where(gdb.GetWhereConditionOfStruct(r)).Delete()
  52. }