web_set_entity.go 2.3 KB

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