Documentation
¶
Index ¶
- type ByBestRated
- type ByCommentCreatedAt
- type Comment
- func (self *Comment) Delete()
- func (self *Comment) GetContent() string
- func (self *Comment) GetParseableMeta() map[string]interface{}
- func (self *Comment) GetPost() *Post
- func (self *Comment) MarkAsAnswer()
- func (self *Comment) OnParseFilterFinished(module string) bool
- func (self *Comment) OnParseFinished() bool
- func (self *Comment) SetDI(o *Post)
- func (self *Comment) Update(c string)
- func (self *Comment) UpdateContent(c string) bool
- type Comments
- type FeedModule
- func (feed *FeedModule) FulfillBestAnswer(list []LightPostModel) []LightPostModel
- func (feed *FeedModule) GetComment(id primitive.ObjectID) (comment *Comment, err error)
- func (feed *FeedModule) LightPost(post interface{}) (*LightPost, error)
- func (feed *FeedModule) LightPosts(posts interface{}) ([]LightPostModel, error)
- func (feed *FeedModule) Post(where interface{}) (post *Post, err error)
- func (feed *FeedModule) TrueCommentCount(id primitive.ObjectID) int
- func (di *FeedModule) UpdateFeedRates(list []model.FeedPost)
- func (di *FeedModule) UpdatePostRate(post model.Post)
- type LightPost
- type LightPostModel
- type List
- type MModelAuthor
- type MModelComment
- type MModelCommentAggregated
- type MModelComments
- type MModelCommentsPost
- type MModelComponent
- type MModelComponents
- type MModelFeedComments
- type MModelFeedPost
- type MModelFeedPostStat
- type MModelPost
- type MModelPostCommentCountModel
- type MModelPostCommentModel
- type MModelPostForm
- type MModelVotes
- type Post
- func (self *Post) DI() *FeedModule
- func (self *Post) Data() *Post
- func (self *Post) GetCommentCount() int
- func (p *Post) GetContent() string
- func (p *Post) GetParseableMeta() map[string]interface{}
- func (self *Post) IsLocked() bool
- func (self *Post) LoadCommentById(id primitive.ObjectID) error
- func (p *Post) LoadUsers()
- func (self *Post) LoadUsersHashtables()
- func (p *Post) LoadVotes(user_id primitive.ObjectID)
- func (self *Post) PushComment(c string, user_id primitive.ObjectID) *Comment
- func (p *Post) PushUser(user_id primitive.ObjectID) bool
- func (self *Post) SetDI(di *FeedModule)
- func (p *Post) UpdateContent(content string) content.Parseable
- type PostCommentCountModel
- type PostCommentModel
- type Vote
- type Votes
- type VotesModel
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ByBestRated ¶
type ByBestRated []MModelFeedPost
func (ByBestRated) Len ¶
func (slice ByBestRated) Len() int
func (ByBestRated) Less ¶
func (slice ByBestRated) Less(i, j int) bool
func (ByBestRated) Swap ¶
func (slice ByBestRated) Swap(i, j int)
type ByCommentCreatedAt ¶
type ByCommentCreatedAt []MModelComment
ByCommentCreatedAt implements sort.Interface for []ElectionOption based on Created field
func (ByCommentCreatedAt) Len ¶
func (a ByCommentCreatedAt) Len() int
func (ByCommentCreatedAt) Less ¶
func (a ByCommentCreatedAt) Less(i, j int) bool
func (ByCommentCreatedAt) Swap ¶
func (a ByCommentCreatedAt) Swap(i, j int)
type Comment ¶
type Comment struct {
Id primitive.ObjectID `bson:"_id,omitempty" json:"id,omitempty"`
PostId primitive.ObjectID `bson:"post_id" json:"post_id"`
UserId primitive.ObjectID `bson:"user_id" json:"user_id"`
Votes Votes `bson:"votes" json:"votes"`
User interface{} `bson:"-" json:"author,omitempty"`
Position int `bson:"position" json:"position"`
Liked int `bson:"-" json:"liked,omitempty"`
Content string `bson:"content" json:"content"`
Chosen bool `bson:"chosen,omitempty" json:"chosen,omitempty"`
Created time.Time `bson:"created_at" json:"created_at"`
// contains filtered or unexported fields
}
func (*Comment) GetContent ¶
func (*Comment) GetParseableMeta ¶
func (*Comment) MarkAsAnswer ¶
func (self *Comment) MarkAsAnswer()
func (*Comment) OnParseFilterFinished ¶
func (*Comment) OnParseFinished ¶
func (*Comment) UpdateContent ¶
type FeedModule ¶
type FeedModule struct {
Errors *exceptions.ExceptionsModule `inject:""`
CacheService *goredis.Redis `inject:""`
User *user.Module `inject:""`
Content *content.Module `inject:""`
}
func (*FeedModule) FulfillBestAnswer ¶
func (feed *FeedModule) FulfillBestAnswer(list []LightPostModel) []LightPostModel
func (*FeedModule) GetComment ¶
func (feed *FeedModule) GetComment(id primitive.ObjectID) (comment *Comment, err error)
func (*FeedModule) LightPost ¶
func (feed *FeedModule) LightPost(post interface{}) (*LightPost, error)
func (*FeedModule) LightPosts ¶
func (feed *FeedModule) LightPosts(posts interface{}) ([]LightPostModel, error)
func (*FeedModule) Post ¶
func (feed *FeedModule) Post(where interface{}) (post *Post, err error)
func (*FeedModule) TrueCommentCount ¶
func (feed *FeedModule) TrueCommentCount(id primitive.ObjectID) int
func (*FeedModule) UpdateFeedRates ¶
func (di *FeedModule) UpdateFeedRates(list []model.FeedPost)
func (*FeedModule) UpdatePostRate ¶
func (di *FeedModule) UpdatePostRate(post model.Post)
type LightPost ¶
type LightPost struct {
// contains filtered or unexported fields
}
func (*LightPost) Data ¶
func (post *LightPost) Data() LightPostModel
type LightPostModel ¶
type LightPostModel struct {
Id primitive.ObjectID `bson:"_id,omitempty" json:"id,omitempty"`
Title string `bson:"title" json:"title"`
Slug string `bson:"slug" json:"slug"`
Content string `bson:"content" json:"content"`
Type string `bson:"type" json:"type"`
Category primitive.ObjectID `bson:"category" json:"category"`
UserId primitive.ObjectID `bson:"user_id,omitempty" json:"user_id,omitempty"`
Pinned bool `bson:"pinned,omitempty" json:"pinned,omitempty"`
IsQuestion bool `bson:"is_question,omitempty" json:"is_question"`
Solved bool `bson:"solved,omitempty" json:"solved,omitempty"`
Lock bool `bson:"lock" json:"lock"`
BestAnswer *Comment `bson:"-" json:"best_answer,omitempty"`
Created time.Time `bson:"created_at" json:"created_at"`
Updated time.Time `bson:"updated_at" json:"updated_at"`
}
type MModelAuthor ¶
type MModelComment ¶
type MModelComment struct {
UserId bson.ObjectId `bson:"user_id" json:"user_id"`
Votes MModelVotes `bson:"votes" json:"votes"`
User interface{} `bson:"-" json:"author,omitempty"`
Position int `bson:"position" json:"position"`
Liked int `bson:"-" json:"liked,omitempty"`
Content string `bson:"content" json:"content"`
Chosen bool `bson:"chosen,omitempty" json:"chosen,omitempty"`
Created time.Time `bson:"created_at" json:"created_at"`
Deleted time.Time `bson:"deleted_at" json:"deleted_at"`
}
type MModelCommentAggregated ¶
type MModelCommentAggregated struct {
Id bson.ObjectId `bson:"_id,omitempty" json:"id,omitempty"`
Comment MModelComment `bson:"comment" json:"comment"`
}
type MModelComments ¶
type MModelComments struct {
Count int `bson:"count" json:"count"`
Total int `bson:"-" json:"total"`
Answer *MModelComment `bson:"-" json:"answer,omitempty"`
Set []MModelComment `bson:"set" json:"set"`
}
type MModelCommentsPost ¶
type MModelCommentsPost struct {
Id bson.ObjectId `bson:"_id,omitempty" json:"id,omitempty"`
Comments MModelComments `bson:"comments" json:"comments"`
}
type MModelComponent ¶
type MModelComponent struct {
Content string `bson:"content" json:"content"`
Votes MModelVotes `bson:"votes" json:"votes"`
Status string `bson:"status" json:"status"`
Voted string `bson:"voted,omitempty" json:"voted,omitempty"`
}
type MModelComponents ¶
type MModelComponents struct {
Cpu MModelComponent `bson:"cpu,omitempty" json:"cpu,omitempty"`
Motherboard MModelComponent `bson:"motherboard,omitempty" json:"motherboard,omitempty"`
Ram MModelComponent `bson:"ram,omitempty" json:"ram,omitempty"`
Storage MModelComponent `bson:"storage,omitempty" json:"storage,omitempty"`
Cooler MModelComponent `bson:"cooler,omitempty" json:"cooler,omitempty"`
Power MModelComponent `bson:"power,omitempty" json:"power,omitempty"`
Cabinet MModelComponent `bson:"cabinet,omitempty" json:"cabinet,omitempty"`
Screen MModelComponent `bson:"screen,omitempty" json:"screen,omitempty"`
Videocard MModelComponent `bson:"videocard,omitempty" json:"videocard,omitempty"`
Software string `bson:"software,omitempty" json:"software,omitempty"`
Budget string `bson:"budget,omitempty" json:"budget,omitempty"`
BudgetCurrency string `bson:"budget_currency,omitempty" json:"budget_currency,omitempty"`
BudgetType string `bson:"budget_type,omitempty" json:"budget_type,omitempty"`
BudgetFlexibility string `bson:"budget_flexibility,omitempty" json:"budget_flexibility,omitempty"`
}
type MModelFeedComments ¶
type MModelFeedComments struct {
Count int `bson:"count" json:"count"`
}
type MModelFeedPost ¶
type MModelFeedPost struct {
Id bson.ObjectId `bson:"_id,omitempty" json:"id,omitempty"`
Title string `bson:"title" json:"title"`
Slug string `bson:"slug" json:"slug"`
Type string `bson:"type" json:"type"`
Categories []string `bson:"categories" json:"categories"`
Users []bson.ObjectId `bson:"users,omitempty" json:"users,omitempty"`
Category bson.ObjectId `bson:"category" json:"category"`
Comments MModelFeedComments `bson:"comments" json:"comments"`
Author user.UserSimple `bson:"author,omitempty" json:"author,omitempty"`
UserId bson.ObjectId `bson:"user_id,omitempty" json:"user_id,omitempty"`
Votes MModelVotes `bson:"votes" json:"votes"`
Pinned bool `bson:"pinned,omitempty" json:"pinned,omitempty"`
Solved bool `bson:"solved,omitempty" json:"solved,omitempty"`
IsQuestion bool `bson:"is_question" json:"is_question"`
Stats MModelFeedPostStat `bson:"stats,omitempty" json:"stats"`
Created time.Time `bson:"created_at" json:"created_at"`
Updated time.Time `bson:"updated_at" json:"updated_at"`
}
type MModelFeedPostStat ¶
type MModelFeedPostStat struct {
Viewed int `bson:"viewed,omitempty" json:"viewed"`
Reached int `bson:"reached,omitempty" json:"reached"`
ViewRate float64 `bson:"view_rate,omitempty" json:"view_rate"`
CommentRate float64 `bson:"comment_rate,omitempty" json:"comment_rate"`
FinalRate float64 `bson:"final_rate,omitempty" json:"final_rate"`
}
type MModelPost ¶
type MModelPost struct {
Id bson.ObjectId `bson:"_id,omitempty" json:"id,omitempty"`
Title string `bson:"title" json:"title"`
Slug string `bson:"slug" json:"slug"`
Type string `bson:"type" json:"type"`
Content string `bson:"content" json:"content"`
Categories []string `bson:"categories" json:"categories"`
Category bson.ObjectId `bson:"category" json:"category"`
Comments MModelComments `bson:"comments" json:"comments"`
Author user.UserSimple `bson:"-" json:"author,omitempty"`
UserId bson.ObjectId `bson:"user_id,omitempty" json:"user_id,omitempty"`
Users []bson.ObjectId `bson:"users,omitempty" json:"users,omitempty"`
Votes MModelVotes `bson:"votes" json:"votes"`
Components MModelComponents `bson:"components,omitempty" json:"components,omitempty"`
RelatedComponents []bson.ObjectId `bson:"related_components,omitempty" json:"related_components,omitempty"`
Following bool `bson:"following,omitempty" json:"following,omitempty"`
Pinned bool `bson:"pinned,omitempty" json:"pinned,omitempty"`
Lock bool `bson:"lock" json:"lock"`
IsQuestion bool `bson:"is_question" json:"is_question"`
Solved bool `bson:"solved,omitempty" json:"solved,omitempty"`
Liked int `bson:"liked,omitempty" json:"liked,omitempty"`
Created time.Time `bson:"created_at" json:"created_at"`
Updated time.Time `bson:"updated_at" json:"updated_at"`
Deleted time.Time `bson:"deleted_at,omitempty" json:"deleted_at,omitempty"`
}
type MModelPostCommentModel ¶
type MModelPostCommentModel struct {
Id bson.ObjectId `bson:"_id,omitempty" json:"id,omitempty"`
Title string `bson:"title" json:"title"`
Slug string `bson:"slug" json:"slug"`
Comment MModelComment `bson:"comment" json:"comment"`
}
type MModelPostForm ¶
type MModelPostForm struct {
Kind string `json:"kind" binding:"required"`
Name string `json:"name" binding:"required"`
Content string `json:"content" binding:"required"`
Budget string `json:"budget"`
Currency string `json:"currency"`
Moves string `json:"moves"`
Software string `json:"software"`
Tag string `json:"tag"`
Category string `json:"category"`
IsQuestion bool `json:"is_question"`
Pinned bool `json:"pinned"`
Lock bool `json:"lock"`
Components map[string]interface{} `json:"components"`
}
type MModelVotes ¶
type Post ¶
type Post struct {
Id primitive.ObjectID `bson:"_id,omitempty" json:"id,omitempty"`
Title string `bson:"title" json:"title"`
Slug string `bson:"slug" json:"slug"`
Type string `bson:"type" json:"type"`
Content string `bson:"content" json:"content"`
Categories []string `bson:"categories" json:"categories"`
Category primitive.ObjectID `bson:"category" json:"category"`
Comments Comments `bson:"comments" json:"comments"`
Author *user.UserSimple `bson:"-" json:"author,omitempty"`
UserId primitive.ObjectID `bson:"user_id,omitempty" json:"user_id,omitempty"`
Users []primitive.ObjectID `bson:"users,omitempty" json:"users,omitempty"`
Votes votes.Votes `bson:"votes" json:"votes"`
RelatedComponents []primitive.ObjectID `bson:"related_components,omitempty" json:"related_components,omitempty"`
Following bool `bson:"following,omitempty" json:"following,omitempty"`
Pinned bool `bson:"pinned,omitempty" json:"pinned,omitempty"`
Lock bool `bson:"lock" json:"lock"`
IsQuestion bool `bson:"is_question" json:"is_question"`
Solved bool `bson:"solved,omitempty" json:"solved,omitempty"`
Views int `bson:"views,omitempty" json:"views"`
Reached int `bson:"reached,omitempty" json:"-"`
Voted []string `bson:"-" json:"voted"`
Created time.Time `bson:"created_at" json:"created_at"`
Updated time.Time `bson:"updated_at" json:"updated_at"`
Deleted time.Time `bson:"deleted_at,omitempty" json:"deleted_at,omitempty"`
// Runtime generated pointers
UsersHashtable map[string]interface{} `bson:"-" json:"usersHashtable"`
// contains filtered or unexported fields
}
Post model refers to board posts
func (*Post) DI ¶
func (self *Post) DI() *FeedModule
func (*Post) GetContent ¶
func (*Post) GetParseableMeta ¶
func (*Post) LoadCommentById ¶
Comment loading by ID for post
func (*Post) LoadUsersHashtables ¶
func (self *Post) LoadUsersHashtables()
func (*Post) PushComment ¶
Push Comment on the post
type PostCommentCountModel ¶
type PostCommentModel ¶
type Vote ¶
type Vote struct {
Id bson.ObjectId `bson:"_id,omitempty" json:"id,omitempty"`
UserId bson.ObjectId `bson:"user_id" json:"user_id"`
Type string `bson:"type" json:"type"`
NestedType string `bson:"nested_type,omitempty" json:"nested_type,omitempty"`
RelatedId bson.ObjectId `bson:"related_id" json:"related_id"`
Value int `bson:"value" json:"value"`
Created time.Time `bson:"created_at" json:"created_at"`
}
type VotesModel ¶
Click to show internal directories.
Click to hide internal directories.