blog_log_entity.go 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. // ==========================================================================
  2. // This is auto-generated by gf cli tool. You may not really want to edit it.
  3. // ==========================================================================
  4. package blog_log
  5. import (
  6. "database/sql"
  7. "github.com/gogf/gf/database/gdb"
  8. )
  9. // Entity is the golang structure for table blog_log.
  10. type Entity struct {
  11. LogId int `orm:"log_id,primary" json:"log_id"`
  12. LogType int `orm:"log_type" json:"log_type"` // 所属分类
  13. LogSign int `orm:"log_sign" json:"log_sign"` // 0.一般 1.置顶,2.幻灯,3.推荐
  14. LogTitle string `orm:"log_title" json:"log_title"` // 日志标题
  15. LogAuthor string `orm:"log_author" json:"log_author"` // 用户名
  16. LogUrl string `orm:"log_url" json:"log_url"` // 跳转地址
  17. LogThumbnail string `orm:"log_thumbnail" json:"log_thumbnail"` // 缩略图
  18. LogHits uint64 `orm:"log_hits" json:"log_hits"` // 查看数点击数
  19. LogComments int64 `orm:"log_comments" json:"log_comments"` // 评论数
  20. CreatTime uint `orm:"creat_time" json:"creat_time"` // 创建时间
  21. LogStatus uint `orm:"log_status" json:"log_status"` // 状态:1发布,0未发布
  22. LogSort int `orm:"log_sort" json:"log_sort"` // 排序
  23. LogContent string `orm:"log_content" json:"log_content"` // 内容
  24. }
  25. // OmitEmpty sets OPTION_OMITEMPTY option for the model, which automatically filers
  26. // the data and where attributes for empty values.
  27. func (r *Entity) OmitEmpty() *arModel {
  28. return Model.Data(r).OmitEmpty()
  29. }
  30. // Inserts does "INSERT...INTO..." statement for inserting current object into table.
  31. func (r *Entity) Insert() (result sql.Result, err error) {
  32. return Model.Data(r).Insert()
  33. }
  34. // InsertIgnore does "INSERT IGNORE INTO ..." statement for inserting current object into table.
  35. func (r *Entity) InsertIgnore() (result sql.Result, err error) {
  36. return Model.Data(r).InsertIgnore()
  37. }
  38. // Replace does "REPLACE...INTO..." statement for inserting current object into table.
  39. // If there's already another same record in the table (it checks using primary key or unique index),
  40. // it deletes it and insert this one.
  41. func (r *Entity) Replace() (result sql.Result, err error) {
  42. return Model.Data(r).Replace()
  43. }
  44. // Save does "INSERT...INTO..." statement for inserting/updating current object into table.
  45. // It updates the record if there's already another same record in the table
  46. // (it checks using primary key or unique index).
  47. func (r *Entity) Save() (result sql.Result, err error) {
  48. return Model.Data(r).Save()
  49. }
  50. // Update does "UPDATE...WHERE..." statement for updating current object from table.
  51. // It updates the record if there's already another same record in the table
  52. // (it checks using primary key or unique index).
  53. func (r *Entity) Update() (result sql.Result, err error) {
  54. return Model.Data(r).Where(gdb.GetWhereConditionOfStruct(r)).Update()
  55. }
  56. // Delete does "DELETE FROM...WHERE..." statement for deleting current object from table.
  57. func (r *Entity) Delete() (result sql.Result, err error) {
  58. return Model.Where(gdb.GetWhereConditionOfStruct(r)).Delete()
  59. }