auth_rule_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 auth_rule
  5. import (
  6. "database/sql"
  7. "github.com/gogf/gf/database/gdb"
  8. )
  9. // Entity is the golang structure for table auth_rule.
  10. type Entity struct {
  11. Id uint `orm:"id,primary" json:"id"` //
  12. Type string `orm:"type" json:"type"` // menu为菜单,file为权限节点
  13. Pid uint `orm:"pid" json:"pid"` // 父ID
  14. Name string `orm:"name,unique" json:"name"` // 规则名称
  15. Title string `orm:"title" json:"title"` // 规则名称
  16. Icon string `orm:"icon" json:"icon"` // 图标
  17. Condition string `orm:"condition" json:"condition"` // 条件
  18. Remark string `orm:"remark" json:"remark"` // 备注
  19. Ismenu uint `orm:"ismenu" json:"ismenu"` // 是否为菜单
  20. Createtime uint `orm:"createtime" json:"createtime"` // 创建时间
  21. Updatetime uint `orm:"updatetime" json:"updatetime"` // 更新时间
  22. Weigh int `orm:"weigh" json:"weigh"` // 权重
  23. Status uint `orm:"status" json:"status"` // 状态
  24. }
  25. // OmitEmpty sets OPTION_OMITEMPTY option for the model, which automatically filers
  26. // the data and where attributes for empty values.
  27. func (r *Entity) OmitEmpty() *arModel {
  28. return Model.Data(r).OmitEmpty()
  29. }
  30. // Inserts does "INSERT...INTO..." statement for inserting current object into table.
  31. func (r *Entity) Insert() (result sql.Result, err error) {
  32. return Model.Data(r).Insert()
  33. }
  34. // Replace does "REPLACE...INTO..." statement for inserting current object into table.
  35. // If there's already another same record in the table (it checks using primary key or unique index),
  36. // it deletes it and insert this one.
  37. func (r *Entity) Replace() (result sql.Result, err error) {
  38. return Model.Data(r).Replace()
  39. }
  40. // Save does "INSERT...INTO..." statement for inserting/updating current object into table.
  41. // It updates the record if there's already another same record in the table
  42. // (it checks using primary key or unique index).
  43. func (r *Entity) Save() (result sql.Result, err error) {
  44. return Model.Data(r).Save()
  45. }
  46. // Update does "UPDATE...WHERE..." statement for updating current object from table.
  47. // It updates the record if there's already another same record in the table
  48. // (it checks using primary key or unique index).
  49. func (r *Entity) Update() (result sql.Result, err error) {
  50. return Model.Data(r).Where(gdb.GetWhereConditionOfStruct(r)).Update()
  51. }
  52. // Delete does "DELETE FROM...WHERE..." statement for deleting current object from table.
  53. func (r *Entity) Delete() (result sql.Result, err error) {
  54. return Model.Where(gdb.GetWhereConditionOfStruct(r)).Delete()
  55. }