post

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: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var PostNotFound = errors.New("post has not been found by given criteria")

PostNotFound err.

Functions

func Boot

func Boot()

func FindRateList

func FindRateList(d deps, date string, offset, limit int) ([]bson.ObjectId, error)

func SomeoneCommentedYourPost

func SomeoneCommentedYourPost(name string, post Post) hermes.Email

func SyncRates

func SyncRates(d deps, kind string, list []bson.ObjectId) error

func TrackReachedList

func TrackReachedList(d deps, list []bson.ObjectId, user bson.ObjectId) (err error)

func TrackView

func TrackView(d deps, id, user bson.ObjectId) (err error)

TrackView for a post/user.

Types

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"`
	Comments          comments        `bson:"comments"`
	Category          bson.ObjectId   `bson:"category" json:"category"`
	UserId            bson.ObjectId   `bson:"user_id,omitempty" json:"user_id,omitempty"`
	Users             []bson.ObjectId `bson:"users,omitempty" json:"users,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"`
}

func FindId

func FindId(deps deps, id bson.ObjectId) (post Post, err error)

func (Post) VotableID

func (p Post) VotableID() bson.ObjectId

func (Post) VotableType

func (Post) VotableType() string

type Posts

type Posts []Post

Posts list.

func FindList

func FindList(deps deps, scopes ...common.Scope) (list Posts, err error)

func (Posts) IDs

func (list Posts) IDs() []bson.ObjectId

func (Posts) Map

func (list Posts) Map() map[bson.ObjectId]Post

Jump to

Keyboard shortcuts

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