Documentation ¶
Index ¶
- Variables
- func DropDatabase(c Config) error
- func SetupDatabase(c Config) error
- type CardComment
- type CardLike
- type CommentNotificationExportData
- type Config
- type FollowNotificationExportData
- type Follower
- type LeaderboardNotificationExportData
- type LikeNotificationExportData
- type MentionNotificationExportData
- type PopularPostNotificationExportData
- type Store
- func (store *Store) AddAllUsersToChannel(channelID globalid.ID) error
- func (store *Store) AddCardsToTopOfFeed(userID globalid.ID, cardRankedIDs []globalid.ID) error
- func (store *Store) AddCoinsToBalance(userID globalid.ID, amount int) error
- func (store *Store) AddToCoinsEarned(cardID globalid.ID, amount int) error
- func (store *Store) AddUserToDefaultChannels(userID globalid.ID) error
- func (store *Store) AssignAliasForUserTipsInThread(userID, threadRootID, aliasID globalid.ID) error
- func (store *Store) AwardCoins(userID globalid.ID, amount int64) error
- func (store *Store) AwardTemporaryCoins(userID globalid.ID, amount int64) error
- func (store *Store) BatchGetLastActiveAt(ids []globalid.ID) ([]*model.DBTime, error)
- func (store *Store) BlockAnonUserInThread(blockingUser, blockedAlias, threadID globalid.ID) error
- func (store *Store) BlockUser(blockingUser, blockedUser globalid.ID) error
- func (store *Store) BuildInitialFeed(userID globalid.ID) error
- func (store *Store) ChangeFeatureSwitchState(featureID globalid.ID, state string) error
- func (store *Store) ClearEmptyNotifications() error
- func (store *Store) ClearEmptyNotificationsForUser(userID globalid.ID) error
- func (store *Store) ClearLeaderboardRankings() error
- func (store *Store) Close() error
- func (store *Store) CountCardsInFeed(userID globalid.ID) (int64, error)
- func (store *Store) CountCardsWithNoReactions() (int, error)
- func (store *Store) CountPostsByAliasInThread(aliasID, threadRootID globalid.ID) (int, error)
- func (store *Store) CreateAnonymousAliases() error
- func (store *Store) DeleteAllCardsForUser(userID globalid.ID) error
- func (store *Store) DeleteAnnouncement(id globalid.ID) error
- func (store *Store) DeleteCard(id globalid.ID) error
- func (store *Store) DeleteCardFromFeeds(cardID globalid.ID) error
- func (store *Store) DeleteExpiredSessions() (int64, error)
- func (store *Store) DeleteFollower(followerID, followeeID globalid.ID) error
- func (store *Store) DeleteInvite(id globalid.ID) error
- func (store *Store) DeleteMentionsForCard(cardID globalid.ID) error
- func (store *Store) DeleteNotification(id globalid.ID) error
- func (store *Store) DeleteNotificationsForCard(cardID globalid.ID) error
- func (store *Store) DeleteReactionForNotification(notifID, userID, cardID globalid.ID) error
- func (store *Store) DeleteSession(id globalid.ID) error
- func (store *Store) DeleteSessionsForUser(userID globalid.ID) error
- func (store *Store) DeleteSwitch(id globalid.ID) error
- func (store *Store) DeleteUser(id globalid.ID) error
- func (store *Store) DeleteUserReaction(userID, cardID globalid.ID) error
- func (store *Store) DeleteUserReactionForType(userID, cardID globalid.ID, typ model.UserReactionType) (int64, error)
- func (store *Store) DeleteWaitlistEntry(email string) error
- func (store *Store) FeaturedCommentsForUser(userID, cardID globalid.ID) ([]*model.Card, error)
- func (store *Store) FeaturedCommentsForUserByCardIDs(userID globalid.ID, cardIDs []globalid.ID) (map[globalid.ID]*model.Card, error)
- func (store *Store) FollowDefaultUsers(userID globalid.ID) error
- func (store *Store) GetAnnouncementForNotification(n *model.Notification) (*model.Announcement, error)
- func (store *Store) GetAnnouncements() ([]*model.Announcement, error)
- func (store *Store) GetAnonymousAlias(id globalid.ID) (*model.AnonymousAlias, error)
- func (store *Store) GetAnonymousAliasByUsername(username string) (*model.AnonymousAlias, error)
- func (store *Store) GetAnonymousAliasLastUsed(userID, threadRootID globalid.ID) (bool, error)
- func (store *Store) GetAnonymousAliases() ([]*model.AnonymousAlias, error)
- func (store *Store) GetAnonymousAliasesByID(ids []globalid.ID) ([]*model.AnonymousAlias, error)
- func (store *Store) GetCard(id globalid.ID) (*model.Card, error)
- func (store *Store) GetCards() ([]*model.Card, error)
- func (store *Store) GetCardsByIDs(ids []globalid.ID) ([]*model.Card, error)
- func (store *Store) GetCardsByInterval(from, to time.Time) ([]*model.Card, error)
- func (store *Store) GetCardsByNodeInRange(nodeID globalid.ID, from, to time.Time) ([]*model.Card, error)
- func (store *Store) GetCardsForChannel(channelID globalid.ID, count, skip int, forUser globalid.ID) ([]*model.Card, error)
- func (store *Store) GetCardsForPopularRankSince(t time.Time) ([]*model.PopularRankEntry, error)
- func (store *Store) GetCardsInFeed(userID globalid.ID) ([]globalid.ID, error)
- func (store *Store) GetCardsWithDeletedByID(ids []globalid.ID) ([]*model.Card, error)
- func (store *Store) GetChannel(id globalid.ID) (*model.Channel, error)
- func (store *Store) GetChannelByHandle(handle string) (*model.Channel, error)
- func (store *Store) GetChannelEngagements() ([]*model.ChannelEngagement, error)
- func (store *Store) GetChannelInfos(userID globalid.ID) ([]*model.ChannelUserInfo, error)
- func (store *Store) GetChannels() ([]*model.Channel, error)
- func (store *Store) GetChannelsByID(ids []globalid.ID) ([]*model.Channel, error)
- func (store *Store) GetChannelsForUser(userID globalid.ID) ([]*model.Channel, error)
- func (store *Store) GetCoinsReceivedNotificationData(notif *model.Notification) (*model.CoinReward, error)
- func (store *Store) GetCommentCount(startDate, endDate time.Time) ([]*model.Count, error)
- func (store *Store) GetCommentExportData(n *model.Notification) (*CommentNotificationExportData, error)
- func (store *Store) GetCurrentBalance(userID globalid.ID) (*model.CoinBalances, error)
- func (store *Store) GetDaysActive(startDate, endDate time.Time) ([]*model.Count, error)
- func (store *Store) GetDefaultChannelIDs() ([]globalid.ID, error)
- func (store *Store) GetEngagement(cardID globalid.ID) (*model.Engagement, error)
- func (store *Store) GetEngagements(cardIDs []globalid.ID) (map[globalid.ID]*model.Engagement, error)
- func (store *Store) GetFeatureSwitches() ([]*model.FeatureSwitch, error)
- func (store *Store) GetFeedCardsFromCurrentTop(userID globalid.ID, perPage, page int) ([]*model.Card, error)
- func (store *Store) GetFeedCardsFromCurrentTopWithQuery(userID globalid.ID, perPage, page int, searchString string) ([]*model.Card, error)
- func (store *Store) GetFlatReplies(id, forUser globalid.ID, latestFirst bool, limitTo int) ([]*model.Card, error)
- func (store *Store) GetFollowExportData(n *model.Notification) (*FollowNotificationExportData, error)
- func (store *Store) GetFollowedCount(startDate, endDate time.Time) ([]*model.Count, error)
- func (store *Store) GetFollowedUsersCount(startDate, endDate time.Time) ([]*model.Count, error)
- func (store *Store) GetFollowing(userID globalid.ID) ([]*model.User, error)
- func (store *Store) GetIntroCardIDs() ([]globalid.ID, error)
- func (store *Store) GetIntroCards() ([]*model.Card, error)
- func (store *Store) GetInvite(id globalid.ID) (*model.Invite, error)
- func (store *Store) GetInviteByToken(token string) (*model.Invite, error)
- func (store *Store) GetInviteForChannelAndNode(channelID, nodeID globalid.ID) (*model.Invite, error)
- func (store *Store) GetInvitedCount(startDate, endDate time.Time) ([]*model.Count, error)
- func (store *Store) GetInvites() ([]*model.Invite, error)
- func (store *Store) GetInvitesByID(ids []globalid.ID) ([]*model.Invite, error)
- func (store *Store) GetInvitesForUser(id globalid.ID) ([]*model.Invite, error)
- func (store *Store) GetIsSubscribed(userID, channelID globalid.ID) (bool, error)
- func (store *Store) GetLastActiveAt(userID globalid.ID) (time.Time, error)
- func (store *Store) GetLeaderboardNotificationExportData(notifID globalid.ID) (*LeaderboardNotificationExportData, error)
- func (store *Store) GetLeaderboardRankings(count, skip int) ([]*model.LeaderboardRank, error)
- func (store *Store) GetLeaderboardRanksFromTransactions(fromTime, toTime time.Time) ([]*model.LeaderboardRank, error)
- func (store *Store) GetLikeNotificationExportData(n *model.Notification) (*LikeNotificationExportData, error)
- func (store *Store) GetMentionExportData(n *model.Notification) (*MentionNotificationExportData, error)
- func (store *Store) GetNotification(notifID globalid.ID) (*model.Notification, error)
- func (store *Store) GetNotifications(userID globalid.ID, page, skip int) ([]*model.Notification, error)
- func (s *Store) GetOAuthAccountBySubject(subject string) (*model.OAuthAccount, error)
- func (store *Store) GetOnSwitches() ([]*model.FeatureSwitch, error)
- func (store *Store) GetPopularPostNotificationExportData(n *model.Notification) (*PopularPostNotificationExportData, error)
- func (store *Store) GetPopularRankCardsForUser(userID globalid.ID, perPage, page int) ([]*model.Card, error)
- func (store *Store) GetPopularRankForCard(cardID globalid.ID) (*model.PopularRankEntry, error)
- func (store *Store) GetPostCount(startDate, endDate time.Time) ([]*model.Count, error)
- func (store *Store) GetPostedCardsForNode(nodeID globalid.ID, count, skip int) ([]*model.Card, error)
- func (store *Store) GetPostedCardsForNodeIncludingAnon(nodeID globalid.ID, count, skip int) ([]*model.Card, error)
- func (store *Store) GetRankableCardsForExampleFeed(channels []globalid.ID, postedAfter time.Time) ([]*model.PopularRankEntry, error)
- func (store *Store) GetRankableCardsForUser(userID globalid.ID) ([]*model.PopularRankEntry, error)
- func (store *Store) GetRankedImmediateReplies(cardID, forUser globalid.ID) ([]*model.Card, error)
- func (store *Store) GetReactedCount(startDate, endDate time.Time) ([]*model.Count, error)
- func (store *Store) GetReceivedReactionsCount(startDate, endDate time.Time) ([]*model.Count, error)
- func (store *Store) GetResetToken(userID globalid.ID) (*model.ResetToken, error)
- func (store *Store) GetSafeUsersByPage(forUser globalid.ID, pageSize, pageNumber int, searchString string) ([]*model.User, error)
- func (store *Store) GetSession(id globalid.ID) (*model.Session, error)
- func (store *Store) GetSessions() ([]*model.Session, error)
- func (store *Store) GetSettings() (*model.Settings, error)
- func (store *Store) GetSubscribedChannels(userID globalid.ID) ([]*model.Channel, error)
- func (store *Store) GetSubscriberCount(channelID globalid.ID) (int, error)
- func (store *Store) GetSwitchByName(name string) (*model.FeatureSwitch, error)
- func (store *Store) GetThread(id, forUser globalid.ID) ([]*model.Card, error)
- func (store *Store) GetThreadCount(id globalid.ID) (int, error)
- func (store *Store) GetThreadCounts(ids []globalid.ID) (map[globalid.ID]int, error)
- func (store *Store) GetTotalDislikeCount(startDate, endDate time.Time) ([]*model.Count, error)
- func (store *Store) GetTotalLikeCount(startDate, endDate time.Time) ([]*model.Count, error)
- func (store *Store) GetTotalReplyCount(startDate, endDate time.Time) ([]*model.Count, error)
- func (store *Store) GetUniqueUserCommentCount(startDate, endDate time.Time) ([]*model.Count, error)
- func (store *Store) GetUnusedAlias(cardID globalid.ID) (*model.AnonymousAlias, error)
- func (store *Store) GetUser(id globalid.ID) (*model.User, error)
- func (store *Store) GetUserByEmail(email string) (*model.User, error)
- func (store *Store) GetUserByUsername(username string) (*model.User, error)
- func (store *Store) GetUserCount() (int, error)
- func (store *Store) GetUserIDs() ([]globalid.ID, error)
- func (store *Store) GetUserReaction(userID, cardID globalid.ID) (*model.UserReaction, error)
- func (store *Store) GetUserReactions(userID globalid.ID, cardIDs []globalid.ID) (map[globalid.ID]*model.UserReaction, error)
- func (store *Store) GetUsers() ([]*model.User, error)
- func (store *Store) GetUsersByID(ids []globalid.ID) ([]*model.User, error)
- func (store *Store) GetUsersByUsernames(usernames []string) ([]*model.User, error)
- func (store *Store) GetUsersNeedingFirstPostNotification() ([]*model.User, error)
- func (store *Store) GetUsersWithoutDelayedInvites() ([]*model.User, error)
- func (store *Store) GetWaitlist() ([]*model.WaitlistEntry, error)
- func (store *Store) GroupInvitesByToken(tokens []string, groupID globalid.ID) error
- func (store *Store) IsFollowing(followerID, followeeID globalid.ID) (bool, error)
- func (store *Store) IsFollowings(followerID globalid.ID, followeeID []globalid.ID) (map[globalid.ID]bool, error)
- func (store *Store) IsSubscribedToChannels(userID globalid.ID, channelIDs []globalid.ID) (map[globalid.ID]bool, error)
- func (store *Store) JoinChannel(userID, channelID globalid.ID) error
- func (store *Store) LatestForType(userID, targetID globalid.ID, typ string, unopenedOnly bool) (*model.Notification, error)
- func (store *Store) LeaveAllChannels(userID globalid.ID) error
- func (store *Store) LeaveChannel(userID, channelID globalid.ID) error
- func (store *Store) MustBegin() *Tx
- func (store *Store) MuteChannel(userID, channelID globalid.ID) error
- func (store *Store) MuteThread(userID, threadRootID globalid.ID) error
- func (store *Store) MuteUser(userID, mutedUserID globalid.ID) error
- func (store *Store) NewContentAvailableForUser(userID, cardID globalid.ID) (bool, error)
- func (store *Store) NewContentAvailableForUserByCards(userID globalid.ID, cardIDs []globalid.ID) (map[globalid.ID]bool, error)
- func (store *Store) PayCoinAmount(userID globalid.ID, amount int64) error
- func (store *Store) ReassignInviterForGroup(rootInviteID, newUserID globalid.ID) error
- func (store *Store) ReassignInvitesByToken(tokens []string, userID globalid.ID) error
- func (store *Store) ResetTemporaryCoins(newBalance int64) error
- func (store *Store) ResetUserFeedTop(userID globalid.ID) error
- func (store *Store) SaveActivity(m *model.Activity) error
- func (store *Store) SaveAnnouncement(m *model.Announcement) error
- func (store *Store) SaveAnonymousAlias(m *model.AnonymousAlias) error
- func (store *Store) SaveCard(m *model.Card) error
- func (store *Store) SaveChannel(m *model.Channel) error
- func (store *Store) SaveCoinTransaction(m *model.CoinTransaction) error
- func (store *Store) SaveFeatureSwitch(m *model.FeatureSwitch) error
- func (store *Store) SaveFollower(followerID, followeeID globalid.ID) error
- func (store *Store) SaveInvite(m *model.Invite) error
- func (store *Store) SaveLeaderboardNotificationData(notifID globalid.ID, rank int) error
- func (store *Store) SaveLeaderboardRank(m *model.LeaderboardRank) error
- func (store *Store) SaveMention(m *model.Mention) error
- func (store *Store) SaveNotification(m *model.Notification) error
- func (store *Store) SaveNotificationComment(m *model.NotificationComment) error
- func (store *Store) SaveNotificationFollow(notifID, followerID, followeeID globalid.ID) error
- func (store *Store) SaveNotificationMention(m *model.NotificationMention) error
- func (s *Store) SaveOAuthAccount(m *model.OAuthAccount) error
- func (store *Store) SavePopularRank(m *model.PopularRankEntry) error
- func (store *Store) SaveReactionForNotification(notifID, userID, cardID globalid.ID) error
- func (store *Store) SaveResetToken(m *model.ResetToken) error
- func (store *Store) SaveScoreModification(m *model.ScoreModification) error
- func (store *Store) SaveSession(m *model.Session) error
- func (store *Store) SaveSettings(m *model.Settings) error
- func (store *Store) SaveUser(m *model.User) error
- func (store *Store) SaveUserReaction(m *model.UserReaction) error
- func (store *Store) SaveUserTip(m *model.UserTip) error
- func (store *Store) SaveWaitlistEntry(m *model.WaitlistEntry) error
- func (store *Store) SetCardVisited(userID, cardID globalid.ID) error
- func (store *Store) SetFeedLastUpdatedForUser(userID globalid.ID, t time.Time) error
- func (store *Store) SetIntroCardStatus(cardID globalid.ID, status bool) error
- func (store *Store) ShadowbanAllCardsForUser(userID globalid.ID) error
- func (store *Store) ShadowbanCard(cardID globalid.ID) error
- func (store *Store) SubscribeToCard(userID, cardID globalid.ID, typ string) error
- func (store *Store) SubscribedToCards(userID globalid.ID, cardIDs []globalid.ID) (map[globalid.ID]bool, error)
- func (store *Store) SubscribedToTypes(userID, cardID globalid.ID) ([]string, error)
- func (store *Store) SubscribersForCard(cardID globalid.ID, typ string) ([]globalid.ID, error)
- func (store *Store) SubtractCoinsFromBalance(userID globalid.ID, amount int) error
- func (store *Store) ToggleUserForFeature(featureID, userID globalid.ID) error
- func (store *Store) UnmuteChannel(userID, channelID globalid.ID) error
- func (store *Store) UnmuteThread(userID, threadRootID globalid.ID) error
- func (store *Store) UnmuteUser(userID, mutedUserID globalid.ID) error
- func (store *Store) UnseenNotificationsCount(userID globalid.ID) (int, error)
- func (store *Store) UnshadowbanCard(cardID globalid.ID) error
- func (store *Store) UnsubscribeFromCard(userID, cardID globalid.ID, typ string) error
- func (store *Store) UpdateAllNotificationsSeen(userID globalid.ID) error
- func (store *Store) UpdateCardRanksForUser(userID globalid.ID, cardIDs []globalid.ID) error
- func (store *Store) UpdateNotificationsOpened(ids []globalid.ID) error
- func (store *Store) UpdateNotificationsSeen(ids []globalid.ID) error
- func (store *Store) UpdatePopularRankForCard(cardID globalid.ID, ...) error
- func (store *Store) UpdatePopularRanksForUser(userID globalid.ID) error
- func (store *Store) UpdatePopularRanksWithList(userID globalid.ID, ids []globalid.ID) error
- func (store *Store) UpdateUniqueCommentersForCard(cardID globalid.ID) error
- func (store *Store) UpdateUserGotDelayedInvites(id globalid.ID) error
- func (store *Store) UpdateViewsForCards(cardIDs []globalid.ID) error
- func (store *Store) UpdateWaitlistEntry(email, comment string) error
- func (store *Store) UsersWithPopularPostsSinceTime(t time.Time) ([]*model.User, error)
- type Tx
- func (tx *Tx) SaveActivity(m *model.Activity) error
- func (tx *Tx) SaveAnnouncement(m *model.Announcement) error
- func (tx *Tx) SaveCard(m *model.Card) error
- func (tx *Tx) SaveChannel(m *model.Channel) error
- func (tx *Tx) SaveCoinTransaction(m *model.CoinTransaction) error
- func (tx *Tx) SaveFeatureSwitch(m *model.FeatureSwitch) error
- func (tx *Tx) SaveFollower(followerID, followeeID globalid.ID) error
- func (tx *Tx) SaveInvite(m *model.Invite) error
- func (tx *Tx) SaveMention(m *model.Mention) error
- func (tx *Tx) SaveNotification(m *model.Notification) error
- func (tx *Tx) SaveNotificationComment(m *model.NotificationComment) error
- func (tx *Tx) SaveNotificationFollow(notifID, followerID, followeeID globalid.ID) error
- func (tx *Tx) SaveNotificationMention(m *model.NotificationMention) error
- func (tx *Tx) SaveOAuthAccount(m *model.OAuthAccount) error
- func (tx *Tx) SaveResetToken(m *model.ResetToken) error
- func (tx *Tx) SaveScoreModification(m *model.ScoreModification) error
- func (tx *Tx) SaveSession(m *model.Session) error
- func (tx *Tx) SaveSettings(m *model.Settings) error
- func (tx *Tx) SaveUser(m *model.User) error
- func (tx *Tx) SaveUserTip(m *model.UserTip) error
- func (tx *Tx) SaveWaitlistEntry(m *model.WaitlistEntry) error
Constants ¶
This section is empty.
Variables ¶
var ErrNoAnonymousAliasLeft = errors.New("no anonymous aliases left")
ErrNoAnonymousAliasLeft is used when all anonymous aliases have been assigned to individual users.
var ErrUserNotFound = errors.New("user not found")
Functions ¶
func SetupDatabase ¶
Types ¶
type CardComment ¶
type CardComment struct { ByName string `db:"by_name"` ImagePath string `db:"image_path"` IsAnonymous bool `db:"is_anonymous"` Timestamp time.Time `db:"created_at"` AuthorUsername string `db:"author_username"` AuthorID globalid.ID `db:"id"` }
func (*CardComment) DisplayName ¶
func (cc *CardComment) DisplayName() string
type CardLike ¶
type CardLike struct { ByName string `db:"by_name"` ImagePath string `db:"image_path"` IsAnonymous bool `db:"is_anonymous"` Timestamp time.Time `db:"created_at"` }
func (*CardLike) DisplayName ¶
type CommentNotificationExportData ¶
type CommentNotificationExportData struct { Comments []*CardComment `db:"-"` RootOwnerID globalid.ID `db:"owner_id"` RootIsAnonymous bool `db:"root_is_anon"` PosterName string `db:"display_name"` PosterImage string `db:"profile_image_path"` CardContent string `db:"content"` ThreadRootID globalid.ID `db:"thread_root_id"` LatestCommentID globalid.ID `db:"latest_comment_id"` LatestCommentParentID globalid.ID `db:"latest_comment_parent_id"` }
type Config ¶
type Config struct { Database string `toml:"database"` Host string `toml:"host"` Port int `toml:"port"` User string `toml:"user"` Password string `toml:"password"` MigrationPath string `toml:"migrationPath"` Environment string `toml:"environment"` MaxConnections int `toml:"maxConnections"` ImageHost string `toml:"imageHost"` AnonymousIconsPath string `toml:"anonymousIconsPath"` Tags []string `toml:"tags"` }
Config provides the configuration required by the store package.
type FollowNotificationExportData ¶
type FollowNotificationExportData struct {
Followers []*Follower `db:"-"`
}
type Follower ¶
type Follower struct { ID globalid.ID `db:"id"` Username string `db:"username"` Name string `db:"display_name"` ImagePath string `db:"profile_image_path"` Timestamp time.Time `db:"created_at"` }
func (*Follower) DisplayName ¶
type LikeNotificationExportData ¶
type LikeNotificationExportData struct { Boosts []*CardLike `db:"-"` IsComment bool `db:"is_comment"` PosterImage string `db:"profile_image_path"` CardContent string `db:"content"` ThreadRootID globalid.ID `db:"thread_root_id"` ThreadReplyID globalid.ID `db:"thread_reply_id"` AuthorUsername string `db:"username"` }
type MentionNotificationExportData ¶
type MentionNotificationExportData struct { Name string `db:"name"` IsAnonymous bool `db:"is_anon"` ImagePath string `db:"image_path"` InComment bool `db:"in_comment"` ThreadRoot globalid.ID `db:"thread_root_id"` ThreadReply globalid.ID `db:"thread_reply_id"` InCard globalid.ID `db:"in_card"` InCardAuthorUsername string `db:"username"` }
type Store ¶
func New ¶
New returns a new instance of Store. It connects to the default database postgres to check whether the application database exists. If it does not, it creates the database and uses the current schema.
func (*Store) AddAllUsersToChannel ¶
AddUserToDefaultChannels stop
func (*Store) AddCardsToTopOfFeed ¶
func (*Store) AddCoinsToBalance ¶
func (*Store) AddToCoinsEarned ¶
func (*Store) AddUserToDefaultChannels ¶
AddUserToDefaultChannels stop
func (*Store) AssignAliasForUserTipsInThread ¶
func (*Store) AwardTemporaryCoins ¶
func (*Store) BatchGetLastActiveAt ¶
func (*Store) BlockAnonUserInThread ¶
func (*Store) ChangeFeatureSwitchState ¶
GetSavedLink returns the saved link for the provided ID
func (*Store) ClearEmptyNotifications ¶
func (*Store) ClearEmptyNotificationsForUser ¶
func (*Store) ClearLeaderboardRankings ¶
func (*Store) CountCardsInFeed ¶
func (*Store) CountCardsWithNoReactions ¶
func (*Store) CountPostsByAliasInThread ¶
func (*Store) CreateAnonymousAliases ¶
CreateAnonymousAliases will update an existing user or create a new user record in the datastore.
func (*Store) DeleteAllCardsForUser ¶
func (*Store) DeleteCardFromFeeds ¶
func (*Store) DeleteExpiredSessions ¶
func (*Store) DeleteFollower ¶
func (*Store) DeleteInvite ¶
DeleteInvite deletes the invite with the provided ID
func (*Store) DeleteMentionsForCard ¶
func (*Store) DeleteNotificationsForCard ¶
func (*Store) DeleteReactionForNotification ¶
func (*Store) DeleteSessionsForUser ¶
func (*Store) DeleteSwitch ¶
GetSavedLink returns the saved link for the provided ID
func (*Store) DeleteUserReaction ¶
func (*Store) DeleteUserReactionForType ¶
func (*Store) DeleteWaitlistEntry ¶
func (*Store) FeaturedCommentsForUser ¶
func (*Store) FeaturedCommentsForUserByCardIDs ¶
func (*Store) GetAnnouncementForNotification ¶
func (store *Store) GetAnnouncementForNotification(n *model.Notification) (*model.Announcement, error)
func (*Store) GetAnnouncements ¶
func (store *Store) GetAnnouncements() ([]*model.Announcement, error)
func (*Store) GetAnonymousAlias ¶
GetAnonymousAlias ---
func (*Store) GetAnonymousAliasByUsername ¶
func (store *Store) GetAnonymousAliasByUsername(username string) (*model.AnonymousAlias, error)
func (*Store) GetAnonymousAliasLastUsed ¶
func (*Store) GetAnonymousAliases ¶
func (store *Store) GetAnonymousAliases() ([]*model.AnonymousAlias, error)
func (*Store) GetAnonymousAliasesByID ¶
func (*Store) GetCardsByIDs ¶
func (*Store) GetCardsByInterval ¶
GetCardsByInterval returns cards posted in a certain time period.
func (*Store) GetCardsByNodeInRange ¶
func (store *Store) GetCardsByNodeInRange(nodeID globalid.ID, from, to time.Time) ([]*model.Card, error)
GetCardsByNodeInRange returns cards posted by a user in a certain time period.
func (*Store) GetCardsForChannel ¶
func (store *Store) GetCardsForChannel(channelID globalid.ID, count, skip int, forUser globalid.ID) ([]*model.Card, error)
GetCardsForChannel returns cards posted to a channel.
func (*Store) GetCardsForPopularRankSince ¶
func (*Store) GetCardsInFeed ¶
func (*Store) GetCardsWithDeletedByID ¶
func (*Store) GetChannel ¶
GetCard reads the given card from the database.
func (*Store) GetChannelByHandle ¶
GetCard reads the given card from the database.
func (*Store) GetChannelEngagements ¶
func (store *Store) GetChannelEngagements() ([]*model.ChannelEngagement, error)
GetCardsForChannel returns cards posted to a channel.
func (*Store) GetChannelInfos ¶
GetCard reads the given card from the database.
func (*Store) GetChannels ¶
GetCard reads the given card from the database.
func (*Store) GetChannelsByID ¶
func (*Store) GetChannelsForUser ¶
GetCard reads the given card from the database.
func (*Store) GetCoinsReceivedNotificationData ¶
func (store *Store) GetCoinsReceivedNotificationData(notif *model.Notification) (*model.CoinReward, error)
func (*Store) GetCommentCount ¶
func (*Store) GetCommentExportData ¶
func (store *Store) GetCommentExportData(n *model.Notification) (*CommentNotificationExportData, error)
func (*Store) GetCurrentBalance ¶
func (*Store) GetDaysActive ¶
func (*Store) GetDefaultChannelIDs ¶
GetCard reads the given card from the database.
func (*Store) GetEngagement ¶
GetEngagement derives engagement for a given card from the cards and reactions table.
The query is at its core a UNION between reactions and cards table. Reactions are filtered by boosts minus reactions to a user's own card. If there is a more recent bury from the user, the boost is not included at all.
Only cards that are replies to the given card are included for the engagement.
The engagement type is determined by the originating row. It's a 'comment' if it's from the cards table and a 'boost' if it is from the reactions table. In case there is a comment and a boost, precedence to the comment is given (see CASE WHEN statement).
In order to fetch associated user or anonymous alias information JOINS are applied. An INNER JOIN for user because the user data is always available and a LEFT JOIN on anonymous alias because the anonymous alias data is only sometimes available.
In order to protect the identity of an anonymous engagement, a COALESCE statement is used to give precedence to the anonymous information.
func (*Store) GetEngagements ¶
func (*Store) GetFeatureSwitches ¶
func (store *Store) GetFeatureSwitches() ([]*model.FeatureSwitch, error)
GetSavedLink returns the saved link for the provided ID
func (*Store) GetFeedCardsFromCurrentTop ¶
func (store *Store) GetFeedCardsFromCurrentTop(userID globalid.ID, perPage, page int) ([]*model.Card, error)
GetFeedCardsFromCurrentTop fetches all the cards which are in a users current feed.
func (*Store) GetFeedCardsFromCurrentTopWithQuery ¶
func (store *Store) GetFeedCardsFromCurrentTopWithQuery(userID globalid.ID, perPage, page int, searchString string) ([]*model.Card, error)
GetFeedCardsFromCurrentTop fetches all the cards which are in a users current feed.
func (*Store) GetFlatReplies ¶
func (store *Store) GetFlatReplies(id, forUser globalid.ID, latestFirst bool, limitTo int) ([]*model.Card, error)
GetThread returns all cards with who are replying to the same card. This is used to display a thread on the application and excludes the thread root.
func (*Store) GetFollowExportData ¶
func (store *Store) GetFollowExportData(n *model.Notification) (*FollowNotificationExportData, error)
func (*Store) GetFollowedCount ¶
func (*Store) GetFollowedUsersCount ¶
func (*Store) GetFollowing ¶
func (*Store) GetIntroCardIDs ¶
GetCards reads all cards from the database.
func (*Store) GetIntroCards ¶
GetCards reads all cards from the database.
func (*Store) GetInviteByToken ¶
GetInviteByToken returns the invite for the provided token
func (*Store) GetInviteForChannelAndNode ¶
func (store *Store) GetInviteForChannelAndNode(channelID, nodeID globalid.ID) (*model.Invite, error)
GetInvites returns all invites from the store
func (*Store) GetInvitedCount ¶
func (*Store) GetInvites ¶
GetInvites returns all invites from the store
func (*Store) GetInvitesByID ¶
func (*Store) GetInvitesForUser ¶
GetInvites returns all invites from the store
func (*Store) GetIsSubscribed ¶
GetCard reads the given card from the database.
func (*Store) GetLastActiveAt ¶
func (*Store) GetLeaderboardNotificationExportData ¶
func (store *Store) GetLeaderboardNotificationExportData(notifID globalid.ID) (*LeaderboardNotificationExportData, error)
func (*Store) GetLeaderboardRankings ¶
func (store *Store) GetLeaderboardRankings(count, skip int) ([]*model.LeaderboardRank, error)
func (*Store) GetLeaderboardRanksFromTransactions ¶
func (*Store) GetLikeNotificationExportData ¶
func (store *Store) GetLikeNotificationExportData(n *model.Notification) (*LikeNotificationExportData, error)
func (*Store) GetMentionExportData ¶
func (store *Store) GetMentionExportData(n *model.Notification) (*MentionNotificationExportData, error)
func (*Store) GetNotification ¶
GetNotifications reads all notifications for a given user from the database.
func (*Store) GetNotifications ¶
func (store *Store) GetNotifications(userID globalid.ID, page, skip int) ([]*model.Notification, error)
GetNotifications reads all notifications for a given user from the database.
func (*Store) GetOAuthAccountBySubject ¶
func (s *Store) GetOAuthAccountBySubject(subject string) (*model.OAuthAccount, error)
GetOAuthAccountBySubject returns the OAuth account from the database with the given subject. This is limited to Facebook OAuth accounts for now.
func (*Store) GetOnSwitches ¶
func (store *Store) GetOnSwitches() ([]*model.FeatureSwitch, error)
GetSavedLink returns the saved link for the provided ID
func (*Store) GetPopularPostNotificationExportData ¶
func (store *Store) GetPopularPostNotificationExportData(n *model.Notification) (*PopularPostNotificationExportData, error)
func (*Store) GetPopularRankCardsForUser ¶
func (*Store) GetPopularRankForCard ¶
func (*Store) GetPostCount ¶
func (*Store) GetPostedCardsForNode ¶
func (store *Store) GetPostedCardsForNode(nodeID globalid.ID, count, skip int) ([]*model.Card, error)
GetPostedCardsForNode returns the number of cards posted by a user.
func (*Store) GetPostedCardsForNodeIncludingAnon ¶
func (store *Store) GetPostedCardsForNodeIncludingAnon(nodeID globalid.ID, count, skip int) ([]*model.Card, error)
GetPostedCardsForNodeIncludingAnon returns the number of cards posted by a user.
func (*Store) GetRankableCardsForExampleFeed ¶
func (*Store) GetRankableCardsForUser ¶
func (*Store) GetRankedImmediateReplies ¶
GetThread returns all cards with who are replying to the same card. This is used to display a thread on the application and excludes the thread root.
func (*Store) GetReactedCount ¶
func (*Store) GetReceivedReactionsCount ¶
func (*Store) GetResetToken ¶
GetResetToken reads a reset token from the database.
func (*Store) GetSafeUsersByPage ¶
func (*Store) GetSubscribedChannels ¶
GetCard reads the given card from the database.
func (*Store) GetSubscriberCount ¶
GetCard reads the given card from the database.
func (*Store) GetSwitchByName ¶
func (store *Store) GetSwitchByName(name string) (*model.FeatureSwitch, error)
GetSavedLink returns the saved link for the provided ID
func (*Store) GetThread ¶
GetThread returns all cards with who are replying to the same card. This is used to display a thread on the application and excludes the thread root.
func (*Store) GetThreadCounts ¶
func (*Store) GetTotalDislikeCount ¶
func (*Store) GetTotalLikeCount ¶
func (*Store) GetTotalReplyCount ¶
func (*Store) GetUniqueUserCommentCount ¶
func (*Store) GetUnusedAlias ¶
func (*Store) GetUserByEmail ¶
func (*Store) GetUserByUsername ¶
GetUserByUsername reads a username identified by its username from the database.
func (*Store) GetUserCount ¶
func (*Store) GetUserReaction ¶
func (*Store) GetUserReactions ¶
func (*Store) GetUsersByID ¶
func (*Store) GetUsersByUsernames ¶
func (*Store) GetUsersNeedingFirstPostNotification ¶
func (*Store) GetUsersWithoutDelayedInvites ¶
func (*Store) GetWaitlist ¶
func (store *Store) GetWaitlist() ([]*model.WaitlistEntry, error)
func (*Store) GroupInvitesByToken ¶
Groups invites together
func (*Store) IsFollowing ¶
func (*Store) IsFollowings ¶
func (*Store) IsSubscribedToChannels ¶
func (*Store) LatestForType ¶
func (store *Store) LatestForType(userID, targetID globalid.ID, typ string, unopenedOnly bool) (*model.Notification, error)
GetNotifications reads all notifications for a given user from the database.
func (*Store) NewContentAvailableForUser ¶
func (*Store) NewContentAvailableForUserByCards ¶
func (*Store) PayCoinAmount ¶
func (*Store) ReassignInviterForGroup ¶
func (*Store) ReassignInvitesByToken ¶
func (*Store) ResetTemporaryCoins ¶
func (*Store) SaveAnnouncement ¶
func (store *Store) SaveAnnouncement(m *model.Announcement) error
SaveAnnouncement saves an Announcement to the store
func (*Store) SaveAnonymousAlias ¶
func (store *Store) SaveAnonymousAlias(m *model.AnonymousAlias) error
func (*Store) SaveChannel ¶
SaveCard saves a card
func (*Store) SaveCoinTransaction ¶
func (store *Store) SaveCoinTransaction(m *model.CoinTransaction) error
SaveCard saves a card
func (*Store) SaveFeatureSwitch ¶
func (store *Store) SaveFeatureSwitch(m *model.FeatureSwitch) error
func (*Store) SaveFollower ¶
func (*Store) SaveInvite ¶
SaveInvite saves an invite to the store
func (*Store) SaveLeaderboardNotificationData ¶
func (*Store) SaveLeaderboardRank ¶
func (store *Store) SaveLeaderboardRank(m *model.LeaderboardRank) error
func (*Store) SaveMention ¶
SaveNotification saves an notification to the store
func (*Store) SaveNotification ¶
func (store *Store) SaveNotification(m *model.Notification) error
SaveNotification saves an notification to the store
func (*Store) SaveNotificationComment ¶
func (store *Store) SaveNotificationComment(m *model.NotificationComment) error
SaveInvite saves an invite to the store
func (*Store) SaveNotificationFollow ¶
SaveInvite saves an invite to the store
func (*Store) SaveNotificationMention ¶
func (store *Store) SaveNotificationMention(m *model.NotificationMention) error
SaveNotification saves an notification to the store
func (*Store) SaveOAuthAccount ¶
func (s *Store) SaveOAuthAccount(m *model.OAuthAccount) error
func (*Store) SavePopularRank ¶
func (store *Store) SavePopularRank(m *model.PopularRankEntry) error
func (*Store) SaveReactionForNotification ¶
func (*Store) SaveResetToken ¶
func (store *Store) SaveResetToken(m *model.ResetToken) error
SaveResetToken writes a reset token to the database.
func (*Store) SaveScoreModification ¶
func (store *Store) SaveScoreModification(m *model.ScoreModification) error
func (*Store) SaveUser ¶
SaveUser will update an existing user or create a new user record in the datastore.
func (*Store) SaveUserReaction ¶
func (store *Store) SaveUserReaction(m *model.UserReaction) error
func (*Store) SaveUserTip ¶
SaveInvite saves an invite to the store
func (*Store) SaveWaitlistEntry ¶
func (store *Store) SaveWaitlistEntry(m *model.WaitlistEntry) error
func (*Store) SetFeedLastUpdatedForUser ¶
func (*Store) SetIntroCardStatus ¶
func (*Store) ShadowbanAllCardsForUser ¶
func (*Store) SubscribeToCard ¶
func (*Store) SubscribedToCards ¶
func (*Store) SubscribedToTypes ¶
func (*Store) SubscribersForCard ¶
func (*Store) SubtractCoinsFromBalance ¶
func (*Store) ToggleUserForFeature ¶
GetSavedLink returns the saved link for the provided ID
func (*Store) UnmuteChannel ¶
func (*Store) UnmuteThread ¶
func (*Store) UnseenNotificationsCount ¶
GetNotifications reads all notifications for a given user from the database.
func (*Store) UnsubscribeFromCard ¶
func (*Store) UpdateAllNotificationsSeen ¶
UpdateNotifcationsSeen marks notifications as seen by setting the last seen at column to now.
func (*Store) UpdateCardRanksForUser ¶
func (*Store) UpdateNotificationsOpened ¶
UpdateNotifcationsOpened marks notifications as opened by setting the last opened at column to now.
func (*Store) UpdateNotificationsSeen ¶
UpdateNotifcationsSeen marks notifications as seen by setting the last seen at column to now.
func (*Store) UpdatePopularRankForCard ¶
func (*Store) UpdatePopularRanksForUser ¶
func (*Store) UpdatePopularRanksWithList ¶
func (*Store) UpdateUniqueCommentersForCard ¶
func (*Store) UpdateUserGotDelayedInvites ¶
func (*Store) UpdateViewsForCards ¶
func (*Store) UpdateWaitlistEntry ¶
type Tx ¶
func (*Tx) SaveAnnouncement ¶
func (tx *Tx) SaveAnnouncement(m *model.Announcement) error
SaveAnnouncement saves an Announcement to the store
func (*Tx) SaveCoinTransaction ¶
func (tx *Tx) SaveCoinTransaction(m *model.CoinTransaction) error
SaveCard saves a card
func (*Tx) SaveFeatureSwitch ¶
func (tx *Tx) SaveFeatureSwitch(m *model.FeatureSwitch) error
func (*Tx) SaveInvite ¶
SaveInvite saves an invite to the store
func (*Tx) SaveMention ¶
SaveNotification saves an notification to the store
func (*Tx) SaveNotification ¶
func (tx *Tx) SaveNotification(m *model.Notification) error
SaveNotification saves an notification to the store
func (*Tx) SaveNotificationComment ¶
func (tx *Tx) SaveNotificationComment(m *model.NotificationComment) error
SaveInvite saves an invite to the store
func (*Tx) SaveNotificationFollow ¶
SaveInvite saves an invite to the store
func (*Tx) SaveNotificationMention ¶
func (tx *Tx) SaveNotificationMention(m *model.NotificationMention) error
SaveNotification saves an notification to the store
func (*Tx) SaveOAuthAccount ¶
func (tx *Tx) SaveOAuthAccount(m *model.OAuthAccount) error
func (*Tx) SaveResetToken ¶
func (tx *Tx) SaveResetToken(m *model.ResetToken) error
SaveResetToken writes a reset token to the database.
func (*Tx) SaveScoreModification ¶
func (tx *Tx) SaveScoreModification(m *model.ScoreModification) error
func (*Tx) SaveUser ¶
SaveUser will update an existing user or create a new user record in the datastore.
func (*Tx) SaveUserTip ¶
SaveInvite saves an invite to the store
func (*Tx) SaveWaitlistEntry ¶
func (tx *Tx) SaveWaitlistEntry(m *model.WaitlistEntry) error
Source Files ¶
- activities.go
- announcements.go
- anonymous_alias.go
- card.go
- channel.go
- coin_rewards.go
- coin_transactions.go
- config.go
- engagement.go
- feature_switch.go
- follower.go
- invite.go
- leaderboard_rankings.go
- mentions.go
- notifications.go
- oauthaccount.go
- popular_feeds.go
- resettoken.go
- score_modification.go
- sessions.go
- settings.go
- stats.go
- store.go
- subscriptions.go
- tx.go
- user.go
- user_feeds.go
- user_reactions.go
- user_tips.go
- waitlist.go