Documentation ¶
Index ¶
- func AddBannedUserToCommunity(id, uid string) error
- func AddFollowedCommunityToUser(id, cslug string) error
- func AddIgnoredUserToUser(id, ignored string) error
- func AddModsToCommunity(id, uid string) error
- func AddVoteToPoll(id, optiontitle, uid string) error
- func CreateMentionsNotificationsFromPost(tid, senderSlug, postContent string)
- func DeleteBannedUserToCommunity(id, uid string) error
- func DeleteCommunity(id string) error
- func DeleteCommunityBySlug(slug string) error
- func DeleteFollowedCommunityToUser(id, cslug string) error
- func DeleteIgnoredUserToUser(id, ignored string) error
- func DeleteModsToCommunity(id, uid string) error
- func DeleteNotification(id string) error
- func DeleteNotificationsByUser(uid string) error
- func DeletePoll(id string) error
- func DeletePollByTopic(id string) error
- func DeletePost(id string) error
- func DeleteTopic(id string) error
- func DeleteVoteToPoll(id, optiontitle, uid string) error
- func EnsureIndex()
- func GetDB() *mgo.Database
- func IncrementPostsNumber(id string, n int) error
- func IncrementTopicsNumber(id string, n int) error
- func MarkAsReadAllNotificationsByUser(uid string) error
- func UpdateCommunity(u Community) error
- func UpdatePost(u Post) error
- func UpdateTopic(u Topic) error
- func UpdateTopicLastUpdate(id string, t int64) error
- func UpdateUser(u User) error
- func UpdateUserLastOnline(id string, t int64) error
- func UpdateUserLastPost(id string, t int64) error
- type Community
- type DB
- type Notification
- type Poll
- type PollOption
- type Post
- type Topic
- func AddTopic(u Topic) (Topic, error)
- func GetTopicById(id string) (Topic, error)
- func GetTopicsByCommunity(cslugs []string, limit, start int) ([]Topic, error)
- func GetTopicsByCommunityWithoutIgnoredUsers(cslugs []string, limit, start int, ignored []bson.ObjectId) ([]Topic, error)
- func GetTopicsByUser(uid string, limit, start int) ([]Topic, error)
- func GetTopicsListWithoutIgnoredUsers(limit, start int, ignored []bson.ObjectId) ([]Topic, error)
- type User
- func AddUser(u User) (User, error)
- func GetUserById(id string) (User, error)
- func GetUserByIdSafe(id string) (User, error)
- func GetUserByPassword(password string) (User, error)
- func GetUserBySlug(slug string) (User, error)
- func GetUserBySlugSafe(slug string) (User, error)
- func GetUsersByIds(ids []bson.ObjectId) ([]User, error)
- func GetUsersByIdsSafe(ids []bson.ObjectId) ([]User, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddIgnoredUserToUser ¶
func AddModsToCommunity ¶
func AddVoteToPoll ¶
func CreateMentionsNotificationsFromPost ¶
func CreateMentionsNotificationsFromPost(tid, senderSlug, postContent string)
Receives the topic id and post content, and create all the notifications for each mention/user inserting them on DB
func DeleteCommunity ¶
func DeleteCommunityBySlug ¶
func DeleteIgnoredUserToUser ¶
func DeleteModsToCommunity ¶
func DeleteNotification ¶
func DeletePoll ¶
func DeletePollByTopic ¶
func DeletePost ¶
func DeleteTopic ¶
func DeleteVoteToPoll ¶
func EnsureIndex ¶
func EnsureIndex()
func IncrementPostsNumber ¶
func IncrementTopicsNumber ¶
func UpdateCommunity ¶
func UpdatePost ¶
func UpdateTopic ¶
func UpdateTopicLastUpdate ¶
func UpdateUser ¶
func UpdateUserLastOnline ¶
func UpdateUserLastPost ¶
Types ¶
type Community ¶
type Community struct { Id bson.ObjectId `json:"id"` Name string `json:"name"` Slug string `json:"slug"` Description string `json:"description"` Picture string `json:"picture"` // Community picture (header picture?) Mods []bson.ObjectId `json:"mods"` // Community Moderators Banned_Users []bson.ObjectId `json:"banned_users"` // Community Moderators Creation_Date int64 `json:"creation_date"` Posts_number int64 `json:"posts_number"` // number of total posts(messages) on the community Topics_number int64 `json:"topics_number"` // number of total topics on the community }
func AddCommunity ¶
func GetAllCommunities ¶
func GetCommunityBySlug ¶
func (*Community) GenerateSlug ¶
func (*Community) IncrementPostsNumber ¶
func (*Community) IncrementTopicsNumber ¶
func (*Community) UserCanPost ¶
type DB ¶
func GetInstance ¶
func GetInstance() *DB
type Notification ¶
type Notification struct { Id bson.ObjectId `json:"id"` Type string `json:"type"` // type of notification (mention, new_post...) Params []string `json:"params"` // params for the notification, example: in a mention [topicid, user who mention, mentioned user] Uid bson.ObjectId `json:"uid"` // sent to User ID Read bool `json:"read"` Creation_Date int64 `json:"creation_date"` }
func AddNotification ¶
func AddNotification(u Notification) (Notification, error)
func GetNotificationById ¶
func GetNotificationById(id string) (Notification, error)
func GetNotificationsByUser ¶
func GetNotificationsByUser(uid string) ([]Notification, error)
func (*Notification) GetAllEntities ¶
func (n *Notification) GetAllEntities() map[string]interface{}
func (*Notification) GetAllEntitiesForMention ¶
func (n *Notification) GetAllEntitiesForMention() map[string]interface{}
func (*Notification) MarkAsRead ¶
func (n *Notification) MarkAsRead()
type Poll ¶
type Poll struct { Id bson.ObjectId `json:"id"` Title string `json:"title"` Options []PollOption `json:"options"` // params for the notification, example: in a mention [topicid, user who mention, mentioned user] Tid bson.ObjectId `json:"tid"` // topic ID of the Poll Creation_Date int64 `json:"creation_date"` Allowed_Options int64 // number of allowed options to select for each user }
func GetPollById ¶
func GetPollByTopic ¶
type PollOption ¶
type Post ¶
type Post struct { Id bson.ObjectId `json:"id"` Uid bson.ObjectId `json:"uid"` Tid bson.ObjectId `json:"tid"` // topic ID Content string `json:"content"` Creation_Date int64 `json:"creation_date"` Editation_Date int64 `json:"editation_date"` }
func GetPostById ¶
type Topic ¶
type Topic struct { Id bson.ObjectId `json:"id"` Title string `json:"title"` Slug string `json:"slug"` Content string `json:"content"` // main post content Uid bson.ObjectId `json:"uid"` Community string `json:"community"` // community slug Creation_Date int64 `json:"creation_date"` Editation_Date int64 `json:"editation_date"` Last_Update int64 `json:"last_update"` Posts_number int64 `json:"posts_number"` // number of posts(messages) on the topic }
func GetTopicById ¶
func GetTopicsByCommunity ¶
func (*Topic) GenerateSlug ¶
func (*Topic) IncrementPostsNumber ¶
type User ¶
type User struct { Id bson.ObjectId `json:"id"` Username string `json:"username"` Slug string `json:"slug"` Email string `json:"email"` Password string `json:"password"` Picture string `json:"picture"` Followed_Communities []string `json:"followed_communities"` // slugs Last_Post_Time int64 `json:"last_post_time"` Last_Online_Time int64 `json:"last_online_time"` Creation_Date int64 `json:"creation_date"` Posts_Number int64 `json:"posts_number"` Topics_Number int64 `json:"topics_number"` IsAdmin bool `json:"isadmin"` IsBanned bool `json:"isbanned"` Ignored_Users []bson.ObjectId `json:"ignored_users"` // users id array Activated bool `json:"activated"` }
func GetUserById ¶
func GetUserByIdSafe ¶
func GetUserByPassword ¶
func GetUserBySlug ¶
func GetUserBySlugSafe ¶
func (*User) ChangePassword ¶
func (*User) GeneratePasswordHash ¶
func (*User) GenerateSlug ¶
Source Files ¶
Click to show internal directories.
Click to hide internal directories.