Documentation ¶
Index ¶
- func BanUser(u *uexky.Uexky, postID string) error
- func BlockPost(u *uexky.Uexky, postID string) error
- func BlockThread(u *uexky.Uexky, threadID string) error
- func CountThreads(u *uexky.Uexky, selector bson.M) (int, error)
- func EditTags(u *uexky.Uexky, threadID, mainTag string, subTags []string) error
- func FindThreads(u *uexky.Uexky, selector bson.M, sq *SliceQuery) ([]*Thread, *SliceInfo, error)
- func GetNotification(u *uexky.Uexky, t NotiType, sq *SliceQuery) ([]*Notification, *SliceInfo, error)
- func GetThreadSlice(u *uexky.Uexky, tags []string, sq *SliceQuery) ([]*Thread, *SliceInfo, error)
- func GetUnreadNotificationCount(u *uexky.Uexky, t NotiType) (int, error)
- func LockThread(u *uexky.Uexky, threadID string) error
- func SendSystemNotification(u *uexky.Uexky, title, content string) error
- func TriggerNotifForPost(u *uexky.Uexky, thread *Thread, post *Post, quotes []*Post) error
- func UpsertTags(u *uexky.Uexky, mainTag string, tagStrings []string) error
- type AuthInfo
- type NotiType
- type Notification
- type Post
- type PostBase
- type PostInput
- type QuotedNotiContent
- type RepliedNotiContent
- type RoleType
- type SliceInfo
- type SliceQuery
- type SystemNotiContent
- type Tag
- type TagTree
- type TagTreeNode
- type Thread
- type ThreadInput
- type User
- func (a *User) AddSubbedTags(u *uexky.Uexky, tags []string) error
- func (a *User) AnonymousID(u *uexky.Uexky, threadID string, new bool) (string, error)
- func (a *User) CheckPriority(u *uexky.Uexky, action, target string) (bool, error)
- func (a *User) DelSubbedTags(u *uexky.Uexky, tags []string) error
- func (a *User) SetName(u *uexky.Uexky, name string) error
- func (a User) String() string
- func (a *User) SyncTags(u *uexky.Uexky, tags []string) error
- type UserGroup
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CountThreads ¶
CountThreads ...
func FindThreads ¶
FindThreads ...
func GetNotification ¶
func GetNotification( u *uexky.Uexky, t NotiType, sq *SliceQuery, ) ([]*Notification, *SliceInfo, error)
GetNotification ...
func GetThreadSlice ¶
func GetThreadSlice(u *uexky.Uexky, tags []string, sq *SliceQuery) ( []*Thread, *SliceInfo, error, )
GetThreadSlice ...
func GetUnreadNotificationCount ¶
GetUnreadNotificationCount ...
func SendSystemNotification ¶
SendSystemNotification Send a system notification
func TriggerNotifForPost ¶
TriggerNotifForPost ...
Types ¶
type AuthInfo ¶
type AuthInfo struct {
// contains filtered or unexported fields
}
AuthInfo impl uexky.Auth
func NewUexkyAuth ¶
NewUexkyAuth make a new AuthInfo and add to Uexky
func (*AuthInfo) CheckPriority ¶
CheckPriority ...
type Notification ¶
type Notification struct { // base info ID string `bson:"id"` Type NotiType `bson:"type"` SendTo bson.ObjectId `bson:"send_to,omitempty"` SendToGroup UserGroup `bson:"send_to_group,omitempty"` EventTime time.Time `bson:"event_time"` HasRead bool `bson:"-"` System *SystemNotiContent `bson:"system,omitempty"` Replied *RepliedNotiContent `bson:"replied,omitempty"` Quoted *QuotedNotiContent `bson:"quoted,omitempty"` }
Notification for save notification in DB
type Post ¶
type Post struct { PostBase ThreadID string `bson:"thread_id"` Anonymous bool `bson:"anonymous"` Author string `bson:"author"` CreateTime time.Time `bson:"create_time"` Blocked bool `bson:"blocked"` Index int `bson:"-"` Quotes []string `bson:"quotes,omitempty"` Content string `bson:"content"` }
Post ...
type PostBase ¶
type PostBase struct { ObjectID bson.ObjectId `bson:"_id"` ID string `bson:"id"` UserID bson.ObjectId `bson:"user_id"` }
PostBase ...
type QuotedNotiContent ¶
type QuotedNotiContent struct { ThreadID string `bson:"thread_id"` PostID string `bson:"post_id"` QuotedPostID string `bson:"quoted_post_id"` Quoter string `bson:"quoter"` QuoterID bson.ObjectId `bson:"quoter_id"` }
QuotedNotiContent ...
type RepliedNotiContent ¶
type RepliedNotiContent struct { ThreadID string `bson:"thread_id"` Repliers []string `bson:"repliers"` ReplierIDs []bson.ObjectId `bson:"replier_ids"` }
RepliedNotiContent ...
type SliceQuery ¶
SliceQuery ...
func (*SliceQuery) Find ¶
func (sq *SliceQuery) Find( u *uexky.Uexky, collection, sort string, queryObj bson.M, result interface{}, ) error
Find ...
func (*SliceQuery) GenQueryByObjectID ¶
func (sq *SliceQuery) GenQueryByObjectID() (bson.M, error)
GenQueryByObjectID ...
func (*SliceQuery) GenQueryByTime ¶
func (sq *SliceQuery) GenQueryByTime(field string) (bson.M, error)
GenQueryByTime in milliSeconds
type SystemNotiContent ¶
SystemNotiContent ...
type Tag ¶
type Tag struct { ObjectID bson.ObjectId `bson:"_id"` Name string `bson:"name"` MainTags []string `bson:"main_tags"` UpdatedTime time.Time `bson:"updated_time"` }
Tag ...
type TagTreeNode ¶
TagTreeNode ...
type Thread ¶
type Thread struct { ObjectID bson.ObjectId `bson:"_id"` // not display in front ID string `bson:"id"` Anonymous bool `bson:"anonymous"` Author string `bson:"author"` UserID bson.ObjectId `bson:"user_id"` // not display in front MainTag string `bson:"main_tag"` SubTags []string `bson:"sub_tags"` Tags []string `bson:"tags"` Title string `bson:"title"` Content string `bson:"content"` Blocked bool `bson:"blocked"` Banned bool `bson:"banned"` CreateTime time.Time `bson:"created_time"` UpdateTime time.Time `bson:"update_time"` Posts []PostBase `bson:"posts"` }
Thread ...
func FindThread ¶
FindThread ...
func FindThreadByID ¶
FindThreadByID ...
func NewThread ¶
func NewThread(u *uexky.Uexky, input *ThreadInput) (*Thread, error)
NewThread init new thread and insert to db
func (*Thread) GetReplies ¶
GetReplies ...
type ThreadInput ¶
type ThreadInput struct { Anonymous bool Content string MainTag string SubTags *[]string Title *string }
ThreadInput ...
func (*ThreadInput) ParseThead ¶
ParseThead ...
type User ¶
type User struct { ID bson.ObjectId `bson:"_id"` Email string `bson:"email"` Name string `bson:"name"` Tags []string `bson:"tags"` ReadNotiTime struct { System time.Time `bson:"system"` Replied time.Time `bson:"replied"` Quoted time.Time `bson:"quoted"` } `bson:"read_noti_time"` Role struct { Type RoleType `bson:"type"` Range []string `bson:"range"` } `bson:"role"` }
User for uexky
func GetUserByEmail ¶
GetUserByEmail ...
func (*User) AddSubbedTags ¶
AddSubbedTags ...
func (*User) AnonymousID ¶
AnonymousID ...
func (*User) CheckPriority ¶
CheckPriority ...
func (*User) DelSubbedTags ¶
DelSubbedTags ...