role_user_entity.go 2.2 KB

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