cms_news_entity.go 3.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. // ==========================================================================
  2. // This is auto-generated by gf cli tool. You may not really want to edit it.
  3. // ==========================================================================
  4. package cms_news
  5. import (
  6. "database/sql"
  7. "github.com/gogf/gf/database/gdb"
  8. )
  9. // Entity is the golang structure for table cms_news.
  10. type Entity struct {
  11. Id uint64 `orm:"id,primary" json:"id"` //
  12. UserId uint64 `orm:"user_id" json:"user_id"` // 发表者用户id
  13. NewsStatus uint `orm:"news_status" json:"news_status"` // 状态;1:已发布;0:未发布;
  14. IsTop uint `orm:"is_top" json:"is_top"` // 是否置顶;1:置顶;0:不置顶
  15. Recommended uint `orm:"recommended" json:"recommended"` // 是否推荐;1:推荐;0:不推荐
  16. NewsHits uint64 `orm:"news_hits" json:"news_hits"` // 查看数
  17. NewsLike uint64 `orm:"news_like" json:"news_like"` // 点赞数
  18. CreateTime uint `orm:"create_time" json:"create_time"` // 创建时间
  19. UpdateTime uint `orm:"update_time" json:"update_time"` // 更新时间
  20. PublishedTime uint `orm:"published_time" json:"published_time"` // 发布时间
  21. DeleteTime uint `orm:"delete_time" json:"delete_time"` // 删除时间
  22. NewsTitle string `orm:"news_title" json:"news_title"` // post标题
  23. NewsKeywords string `orm:"news_keywords" json:"news_keywords"` // seo keywords
  24. NewsExcerpt string `orm:"news_excerpt" json:"news_excerpt"` // post摘要
  25. NewsSource string `orm:"news_source" json:"news_source"` // 转载文章的来源
  26. Thumbnail string `orm:"thumbnail" json:"thumbnail"` // 缩略图
  27. IsJump uint `orm:"is_jump" json:"is_jump"` // 是否跳转地址
  28. JumpUrl string `orm:"jump_url" json:"jump_url"` // 跳转地址
  29. }
  30. // OmitEmpty sets OPTION_OMITEMPTY option for the model, which automatically filers
  31. // the data and where attributes for empty values.
  32. func (r *Entity) OmitEmpty() *arModel {
  33. return Model.Data(r).OmitEmpty()
  34. }
  35. // Inserts does "INSERT...INTO..." statement for inserting current object into table.
  36. func (r *Entity) Insert() (result sql.Result, err error) {
  37. return Model.Data(r).Insert()
  38. }
  39. // InsertIgnore does "INSERT IGNORE INTO ..." statement for inserting current object into table.
  40. func (r *Entity) InsertIgnore() (result sql.Result, err error) {
  41. return Model.Data(r).InsertIgnore()
  42. }
  43. // Replace does "REPLACE...INTO..." statement for inserting current object into table.
  44. // If there's already another same record in the table (it checks using primary key or unique index),
  45. // it deletes it and insert this one.
  46. func (r *Entity) Replace() (result sql.Result, err error) {
  47. return Model.Data(r).Replace()
  48. }
  49. // Save does "INSERT...INTO..." statement for inserting/updating current object into table.
  50. // It updates the record if there's already another same record in the table
  51. // (it checks using primary key or unique index).
  52. func (r *Entity) Save() (result sql.Result, err error) {
  53. return Model.Data(r).Save()
  54. }
  55. // Update does "UPDATE...WHERE..." statement for updating current object from table.
  56. // It updates the record if there's already another same record in the table
  57. // (it checks using primary key or unique index).
  58. func (r *Entity) Update() (result sql.Result, err error) {
  59. return Model.Data(r).Where(gdb.GetWhereConditionOfStruct(r)).Update()
  60. }
  61. // Delete does "DELETE FROM...WHERE..." statement for deleting current object from table.
  62. func (r *Entity) Delete() (result sql.Result, err error) {
  63. return Model.Where(gdb.GetWhereConditionOfStruct(r)).Delete()
  64. }