cms_news_entity.go 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  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. CateId uint `orm:"cate_id" json:"cate_id"` // 栏目id
  13. NewsFormat uint `orm:"news_format" json:"news_format"` // 内容格式;1:html;2:md
  14. UserId uint64 `orm:"user_id" json:"user_id"` // 发表者用户id
  15. NewsStatus uint `orm:"news_status" json:"news_status"` // 状态;1:已发布;0:未发布;
  16. IsTop uint `orm:"is_top" json:"is_top"` // 是否置顶;1:置顶;0:不置顶
  17. Recommended uint `orm:"recommended" json:"recommended"` // 是否推荐;1:推荐;0:不推荐
  18. NewsHits uint64 `orm:"news_hits" json:"news_hits"` // 查看数
  19. NewsLike uint64 `orm:"news_like" json:"news_like"` // 点赞数
  20. CreateTime uint `orm:"create_time" json:"create_time"` // 创建时间
  21. UpdateTime uint `orm:"update_time" json:"update_time"` // 更新时间
  22. PublishedTime uint `orm:"published_time" json:"published_time"` // 发布时间
  23. DeleteTime uint `orm:"delete_time" json:"delete_time"` // 删除时间
  24. NewsTitle string `orm:"news_title" json:"news_title"` // post标题
  25. NewsKeywords string `orm:"news_keywords" json:"news_keywords"` // seo keywords
  26. NewsExcerpt string `orm:"news_excerpt" json:"news_excerpt"` // post摘要
  27. NewsSource string `orm:"news_source" json:"news_source"` // 转载文章的来源
  28. NewsContent string `orm:"news_content" json:"news_content"` // 文章内容
  29. Thumbnail string `orm:"thumbnail" json:"thumbnail"` // 缩略图
  30. IsJump uint `orm:"is_jump" json:"is_jump"` // 是否跳转地址
  31. JumpUrl string `orm:"jump_url" json:"jump_url"` // 跳转地址
  32. IsPushed uint `orm:"is_pushed" json:"is_pushed"` // 是否已推送
  33. }
  34. // OmitEmpty sets OPTION_OMITEMPTY option for the model, which automatically filers
  35. // the data and where attributes for empty values.
  36. func (r *Entity) OmitEmpty() *arModel {
  37. return Model.Data(r).OmitEmpty()
  38. }
  39. // Inserts does "INSERT...INTO..." statement for inserting current object into table.
  40. func (r *Entity) Insert() (result sql.Result, err error) {
  41. return Model.Data(r).Insert()
  42. }
  43. // InsertIgnore does "INSERT IGNORE INTO ..." statement for inserting current object into table.
  44. func (r *Entity) InsertIgnore() (result sql.Result, err error) {
  45. return Model.Data(r).InsertIgnore()
  46. }
  47. // Replace does "REPLACE...INTO..." statement for inserting current object into table.
  48. // If there's already another same record in the table (it checks using primary key or unique index),
  49. // it deletes it and insert this one.
  50. func (r *Entity) Replace() (result sql.Result, err error) {
  51. return Model.Data(r).Replace()
  52. }
  53. // Save does "INSERT...INTO..." statement for inserting/updating current object into table.
  54. // It updates the record if there's already another same record in the table
  55. // (it checks using primary key or unique index).
  56. func (r *Entity) Save() (result sql.Result, err error) {
  57. return Model.Data(r).Save()
  58. }
  59. // Update does "UPDATE...WHERE..." statement for updating current object from table.
  60. // It updates the record if there's already another same record in the table
  61. // (it checks using primary key or unique index).
  62. func (r *Entity) Update() (result sql.Result, err error) {
  63. return Model.Data(r).Where(gdb.GetWhereConditionOfStruct(r)).Update()
  64. }
  65. // Delete does "DELETE FROM...WHERE..." statement for deleting current object from table.
  66. func (r *Entity) Delete() (result sql.Result, err error) {
  67. return Model.Where(gdb.GetWhereConditionOfStruct(r)).Delete()
  68. }