plug_ad_entity.go 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. // ==========================================================================
  2. // This is auto-generated by gf cli tool. You may not really want to edit it.
  3. // ==========================================================================
  4. package plug_ad
  5. import (
  6. "database/sql"
  7. "github.com/gogf/gf/database/gdb"
  8. )
  9. // Entity is the golang structure for table plug_ad.
  10. type Entity struct {
  11. AdId int `orm:"ad_id,primary" json:"ad_id"` //
  12. AdName string `orm:"ad_name" json:"ad_name"` // 广告名称
  13. AdAdtypeid int `orm:"ad_adtypeid" json:"ad_adtypeid"` // 所属位置
  14. AdCheckid int `orm:"ad_checkid" json:"ad_checkid"` // 1=图片 2=JS
  15. AdJs string `orm:"ad_js" json:"ad_js"` // JS代码
  16. AdPic string `orm:"ad_pic" json:"ad_pic"` // 广告图片URL
  17. AdUrl string `orm:"ad_url" json:"ad_url"` // 广告链接
  18. AdContent string `orm:"ad_content" json:"ad_content"` // 广告文字内容
  19. AdAddtime int `orm:"ad_addtime" json:"ad_addtime"` // 添加时间
  20. AdSort int `orm:"ad_sort" json:"ad_sort"` // 排序
  21. AdOpen int `orm:"ad_open" json:"ad_open"` // 1=审核 0=未审核
  22. }
  23. // OmitEmpty sets OPTION_OMITEMPTY option for the model, which automatically filers
  24. // the data and where attributes for empty values.
  25. func (r *Entity) OmitEmpty() *arModel {
  26. return Model.Data(r).OmitEmpty()
  27. }
  28. // Inserts does "INSERT...INTO..." statement for inserting current object into table.
  29. func (r *Entity) Insert() (result sql.Result, err error) {
  30. return Model.Data(r).Insert()
  31. }
  32. // InsertIgnore does "INSERT IGNORE INTO ..." statement for inserting current object into table.
  33. func (r *Entity) InsertIgnore() (result sql.Result, err error) {
  34. return Model.Data(r).InsertIgnore()
  35. }
  36. // Replace does "REPLACE...INTO..." statement for inserting current object into table.
  37. // If there's already another same record in the table (it checks using primary key or unique index),
  38. // it deletes it and insert this one.
  39. func (r *Entity) Replace() (result sql.Result, err error) {
  40. return Model.Data(r).Replace()
  41. }
  42. // Save does "INSERT...INTO..." statement for inserting/updating current object into table.
  43. // It updates the record if there's already another same record in the table
  44. // (it checks using primary key or unique index).
  45. func (r *Entity) Save() (result sql.Result, err error) {
  46. return Model.Data(r).Save()
  47. }
  48. // Update does "UPDATE...WHERE..." statement for updating current object from table.
  49. // It updates the record if there's already another same record in the table
  50. // (it checks using primary key or unique index).
  51. func (r *Entity) Update() (result sql.Result, err error) {
  52. return Model.Data(r).Where(gdb.GetWhereConditionOfStruct(r)).Update()
  53. }
  54. // Delete does "DELETE FROM...WHERE..." statement for deleting current object from table.
  55. func (r *Entity) Delete() (result sql.Result, err error) {
  56. return Model.Where(gdb.GetWhereConditionOfStruct(r)).Delete()
  57. }