Documentation
¶
Index ¶
- func Create(entity *Entity) error
- func CreateWithDB(db *gorm.DB, entity *Entity) error
- func DeleteEntity(entity *Entity) int64
- func GetMapByIds(ids []uint64) map[uint64]*Entity
- func GetMaxId() uint64
- func GetMaxPostNoByTopicId(topicId uint64) uint64
- func Save(entity *Entity) error
- func SaveNoUpdate(entity *Entity) error
- func SaveOrCreateById(entity *Entity) int64
- func SaveReviewed(entity *Entity, version uint64) error
- func UpdateProcessStatus(id uint64, processStatus int8) error
- type Entity
- func Get(id uint64) (entity Entity)
- func GetByIds(ids []uint64) (entities []*Entity)
- func GetByTopicIdAfter(topicId uint64, id uint64, limit int) (entities []*Entity)
- func GetByTopicIdBefore(topicId uint64, id uint64, limit int) (entities []*Entity)
- func GetByTopicPostNoAfter(topicId uint64, postNo uint64, limit int) (entities []*Entity)
- func GetByTopicPostNoAsc(topicId uint64, limit int) (entities []*Entity)
- func GetByTopicPostNoAtOrAfter(topicId uint64, postNo uint64) (entity Entity, ok bool)
- func GetByTopicPostNoAtOrBefore(topicId uint64, postNo uint64) (entity Entity, ok bool)
- func GetByTopicPostNoBefore(topicId uint64, postNo uint64, limit int) (entities []*Entity)
- func GetByTopicPostNoDesc(topicId uint64, limit int) (entities []*Entity)
- func GetFirstPageByTopicId(topicId uint64) (entities []*Entity)
- func GetLastByTopicID(topicID uint64) (entity Entity, ok bool)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateWithDB ¶ added in v0.2.61
CreateWithDB leaves event publication to the transaction owner.
func DeleteEntity ¶
func GetMapByIds ¶
func GetMaxPostNoByTopicId ¶
func SaveNoUpdate ¶
func SaveOrCreateById ¶
func SaveReviewed ¶ added in v0.2.74
SaveReviewed compares the version before changing content or an admin decision.
func UpdateProcessStatus ¶
Types ¶
type Entity ¶
type Entity struct {
PublishedAt *time.Time `gorm:"column:published_at" json:"-"`
Id uint64 `` /* 131-byte string literal not displayed */
TopicId uint64 `` /* 238-byte string literal not displayed */
PostNo uint64 `gorm:"column:post_no;type:bigint unsigned;not null;default:0;uniqueIndex:idx_posts_topic_no,priority:2;" json:"postNo"`
UserId uint64 `gorm:"column:user_id;type:bigint unsigned;not null;default:0;index;" json:"userId"`
ReplyToPostId uint64 `gorm:"column:reply_to_post_id;type:bigint unsigned;not null;default:0;" json:"replyToPostId"`
Content string `gorm:"column:content;type:text;" json:"content"`
RenderedHTML string `gorm:"column:rendered_html;type:text;" json:"renderedHTML"`
RenderedVersion uint32 `gorm:"column:rendered_version;type:bigint unsigned;not null;default:0;" json:"renderedVersion"`
ProcessStatus int8 `gorm:"column:process_status;type:tinyint;not null;default:0;index:idx_posts_topic_process,priority:2;" json:"processStatus"`
ModerationStatus string `` /* 130-byte string literal not displayed */
ModerationVersion uint64 `gorm:"column:moderation_version;type:bigint unsigned;not null;default:0" json:"-"`
ModerationReason string `gorm:"column:moderation_reason;type:varchar(512);not null;default:''" json:"-"`
ModeratedAt *time.Time `gorm:"column:moderated_at" json:"-"`
CreatedAt time.Time `gorm:"column:created_at;autoCreateTime;<-:create;index:idx_posts_topic_created,priority:2;" json:"createdAt"`
UpdatedAt time.Time `gorm:"column:updated_at;autoUpdateTime;;index:idx_posts_review,priority:2" json:"updatedAt"`
DeletedAt gorm.DeletedAt `json:"-"`
}
func GetByTopicIdAfter ¶
func GetByTopicIdBefore ¶
func GetByTopicPostNoAfter ¶
func GetByTopicPostNoAsc ¶
func GetByTopicPostNoBefore ¶
func GetByTopicPostNoDesc ¶
func GetFirstPageByTopicId ¶
func GetLastByTopicID ¶ added in v0.2.51
func (Entity) WasPublished ¶ added in v0.2.74
Older replies predate moderation and were already published. Preserve that fact when they are first edited under the new schema.
Click to show internal directories.
Click to hide internal directories.