blog_comment_entity.go 3.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. // ==========================================================================
  2. // This is auto-generated by gf cli tool. You may not really want to edit it.
  3. // ==========================================================================
  4. package blog_comment
  5. import (
  6. "database/sql"
  7. "github.com/gogf/gf/database/gdb"
  8. )
  9. // Entity is the golang structure for table blog_comment.
  10. type Entity struct {
  11. CommentId uint `orm:"comment_id,primary" json:"comment_id"` //
  12. CommentUserId uint `orm:"comment_user_id" json:"comment_user_id"` // 评论用户的用户id
  13. CommentContent string `orm:"comment_content" json:"comment_content"` // 评论内容
  14. CommentPid uint `orm:"comment_pid" json:"comment_pid"` // 当前评论所回复的父评论的id
  15. CommentNum uint `orm:"comment_num" json:"comment_num"` // 当前评论的回复数(下一级子评论数)
  16. CommentStatus uint `orm:"comment_status" json:"comment_status"` // 此评论的状态,0隐藏,1发布
  17. CommentLogId uint `orm:"comment_log_id" json:"comment_log_id"` // 当前评论所属日志id
  18. CreateTime uint `orm:"create_time" json:"create_time"` // 评论创建时间
  19. CommentNickname string `orm:"comment_nickname" json:"comment_nickname"` // 评论用户昵称
  20. ReplyName string `orm:"reply_name" json:"reply_name"` // 当前所回复的对象昵称
  21. ReplyId uint `orm:"reply_id" json:"reply_id"` // 当前回复对象的id
  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. }