Documentation ¶
Index ¶
- Variables
- func CanView(postID int64, u *session.Session, postCache ...*Post) error
- func GetPostsTotal(u *session.Session) (total int64, err error)
- func GetUserId(postID int64) (int64, error)
- func GetUserPostsTotal(userID int64) (total int64, err error)
- func Published(postID int64) (bool, error)
- func UpdateContent(postID int64, content string) error
- func ValidateContent(content string) error
- type List
- type ListPosts
- type Post
- func (p *Post) ContentValid() error
- func (z *Post) DecodeMsg(dc *msgp.Reader) (err error)
- func (z *Post) EncodeMsg(en *msgp.Writer) (err error)
- func (p *Post) Insert() error
- func (p *Post) IsPoster(userID int64) bool
- func (p *Post) IsPublished() bool
- func (p *Post) MDtoHTMLContent()
- func (z *Post) MarshalMsg(b []byte) (o []byte, err error)
- func (z *Post) Msgsize() (s int)
- func (p *Post) Publish() error
- func (z *Post) UnmarshalMsg(bts []byte) (o []byte, err error)
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrContentLength = errtools.InvalidLen(0, 65500)
ErrContentLength max 65500
View Source
var (
ErrNoPost = errors.New("post/post: Error No Post Found OR Insufficient permission to view this post")
)
Viewing post errors
Functions ¶
func GetPostsTotal ¶
GetPostsTotal TODO: Cache!!!
func GetUserPostsTotal ¶
GetUserPostsTotal TODO: Cache!!!
func UpdateContent ¶
Types ¶
type Post ¶
type Post struct { ID int64 `msg:"id" json:"id"` UserID int64 `msg:"userId" json:"userId"` Created int64 `msg:"created" json:"created,omitempty"` Published int64 `msg:"published" json:"published"` Updated int64 `msg:"updated" json:"updated"` Content string `msg:"content" json:"content"` Media bool `msg:"media" json:"media"` MediaList []*media.Media `msg:"mediaList" json:"mediaList,omitempty"` }
Post struct
func GetForUser ¶
GetForUser returns post if user can view it
func (*Post) ContentValid ¶
ContentValid is html escaped content valid
func (*Post) MDtoHTMLContent ¶
func (p *Post) MDtoHTMLContent()
MDtoHTMLContent convert markdown to html and sanitize
func (*Post) MarshalMsg ¶
MarshalMsg implements msgp.Marshaler
Click to show internal directories.
Click to hide internal directories.