role_menu_entity.go 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. // ==========================================================================
  2. // This is auto-generated by gf cli tool. You may not really want to edit it.
  3. // ==========================================================================
  4. package role_menu
  5. import (
  6. "database/sql"
  7. "github.com/gogf/gf/database/gdb"
  8. )
  9. // Entity is the golang structure for table sys_role_menu.
  10. type Entity struct {
  11. Id int `orm:"id,primary" json:"id"` // 主键
  12. RoleId int `orm:"role_id" json:"roleId"` // 角色id
  13. MenuId int `orm:"menu_id" json:"menuId"` // 菜单id
  14. }
  15. // OmitEmpty sets OPTION_OMITEMPTY option for the model, which automatically filers
  16. // the data and where attributes for empty values.
  17. func (r *Entity) OmitEmpty() *arModel {
  18. return Model.Data(r).OmitEmpty()
  19. }
  20. // Inserts does "INSERT...INTO..." statement for inserting current object into table.
  21. func (r *Entity) Insert() (result sql.Result, err error) {
  22. return Model.Data(r).Insert()
  23. }
  24. // Replace does "REPLACE...INTO..." statement for inserting current object into table.
  25. // If there's already another same record in the table (it checks using primary key or unique index),
  26. // it deletes it and insert this one.
  27. func (r *Entity) Replace() (result sql.Result, err error) {
  28. return Model.Data(r).Replace()
  29. }
  30. // Save does "INSERT...INTO..." statement for inserting/updating current object into table.
  31. // It updates the record if there's already another same record in the table
  32. // (it checks using primary key or unique index).
  33. func (r *Entity) Save() (result sql.Result, err error) {
  34. return Model.Data(r).Save()
  35. }
  36. // Update does "UPDATE...WHERE..." statement for updating current object from table.
  37. // It updates the record if there's already another same record in the table
  38. // (it checks using primary key or unique index).
  39. func (r *Entity) Update() (result sql.Result, err error) {
  40. return Model.Data(r).Where(gdb.GetWhereConditionOfStruct(r)).Update()
  41. }
  42. // Delete does "DELETE FROM...WHERE..." statement for deleting current object from table.
  43. func (r *Entity) Delete() (result sql.Result, err error) {
  44. return Model.Where(gdb.GetWhereConditionOfStruct(r)).Delete()
  45. }