feed

package
v0.0.0-...-fe1601c Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 14, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

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       bson.ObjectId `bson:"_id,omitempty" json:"id,omitempty"`
	PostId   bson.ObjectId `bson:"post_id" json:"post_id"`
	UserId   bson.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) Delete

func (self *Comment) Delete()

func (*Comment) GetContent

func (self *Comment) GetContent() string

func (*Comment) GetParseableMeta

func (self *Comment) GetParseableMeta() map[string]interface{}

func (*Comment) GetPost

func (self *Comment) GetPost() *Post

func (*Comment) MarkAsAnswer

func (self *Comment) MarkAsAnswer()

func (*Comment) OnParseFilterFinished

func (self *Comment) OnParseFilterFinished(module string) bool

func (*Comment) OnParseFinished

func (self *Comment) OnParseFinished() bool

func (*Comment) SetDI

func (self *Comment) SetDI(o *Post)

func (*Comment) Update

func (self *Comment) Update(c string)

func (*Comment) UpdateContent

func (self *Comment) UpdateContent(c string) bool

type Comments

type Comments struct {
	Count  int        `bson:"count" json:"count"`
	Total  int        `bson:"-" json:"total"`
	Answer *Comment   `bson:"-" json:"answer,omitempty"`
	Set    []*Comment `bson:"-" json:"set"`
}

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 bson.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 bson.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         bson.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   bson.ObjectId `bson:"category" json:"category"`
	UserId     bson.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 List

type List struct {
	// contains filtered or unexported fields
}

type MModelAuthor

type MModelAuthor struct {
	Id      bson.ObjectId `bson:"id,omitempty" json:"id,omitempty"`
	Name    string        `bson:"name" json:"name"`
	Email   string        `bson:"email" json:"email"`
	Avatar  string        `bson:"avatar" json:"avatar"`
	Profile interface{}   `bson:"profile,omitempty" json:"profile,omitempty"`
}

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 MModelPostCommentCountModel

type MModelPostCommentCountModel struct {
	Id    bson.ObjectId `bson:"_id,omitempty" json:"id,omitempty"`
	Count int           `bson:"count" json:"count"`
}

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 MModelVotes struct {
	Up     int `bson:"up" json:"up"`
	Down   int `bson:"down" json:"down"`
	Rating int `bson:"rating,omitempty" json:"rating,omitempty"`
}

type Post

type Post 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          Comments         `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             votes.Votes      `bson:"votes" json:"votes"`
	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"`
	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) Data

func (self *Post) Data() *Post

Get post data structure

func (*Post) GetCommentCount

func (self *Post) GetCommentCount() int

Alias of TrueCommentCount

func (*Post) GetContent

func (p *Post) GetContent() string

func (*Post) GetParseableMeta

func (p *Post) GetParseableMeta() map[string]interface{}

func (*Post) IsLocked

func (self *Post) IsLocked() bool

func (*Post) LoadCommentById

func (self *Post) LoadCommentById(id bson.ObjectId) error

Comment loading by ID for post

func (*Post) LoadUsers

func (p *Post) LoadUsers()

LoadUsers for a post.

func (*Post) LoadUsersHashtables

func (self *Post) LoadUsersHashtables()

func (*Post) LoadVotes

func (p *Post) LoadVotes(user_id bson.ObjectId)

LoadVotes for a post/user.

func (*Post) PushComment

func (self *Post) PushComment(c string, user_id bson.ObjectId) *Comment

Push Comment on the post

func (*Post) PushUser

func (p *Post) PushUser(user_id bson.ObjectId) bool

Push new user to the participants list

func (*Post) SetDI

func (self *Post) SetDI(di *FeedModule)

Set Dependency Injection pointer

func (*Post) UpdateContent

func (p *Post) UpdateContent(content string) content.Parseable

type PostCommentCountModel

type PostCommentCountModel struct {
	Id    bson.ObjectId `bson:"_id,omitempty" json:"id,omitempty"`
	Count int           `bson:"count" json:"count"`
}

type PostCommentModel

type PostCommentModel struct {
	Id      bson.ObjectId `bson:"_id,omitempty" json:"id,omitempty"`
	Comment Comment       `bson:"comment" json:"comment,omitempty"`
}

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 Votes

type Votes struct {
	Up     int `bson:"up" json:"up"`
	Down   int `bson:"down" json:"down"`
	Rating int `bson:"rating,omitempty" json:"rating,omitempty"`
}

type VotesModel

type VotesModel struct {
	Up     int `bson:"up" json:"up"`
	Down   int `bson:"down" json:"down"`
	Rating int `bson:"rating,omitempty" json:"rating,omitempty"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL