Documentation ¶
Index ¶
- Constants
- Variables
- func CardReaction(reaction ReactionType) bool
- func ExplicitReaction(reaction ReactionType) bool
- func GossipedReaction(reaction ReactionType) bool
- func GraphCardReaction(reaction ReactionType) bool
- func HashPassword(password string) (string, error)
- func HashResetToken(token globalid.ID) (string, error)
- func NewDBTime(t time.Time) dbTime
- func NilDBTime() dbTime
- func TimeByNormalizedDerivativePower(v, power float64) float64
- func ValidateChannelName(name string) error
- func ValidateUsername(username string, blacklist map[string]bool) error
- func VoteReaction(reaction ReactionType) bool
- type Activity
- type Announcement
- type AnnouncementActionData
- type AnonymousAlias
- type AttentionNode
- type Author
- type Card
- type CardReport
- type CardResponse
- type CardView
- type CardsResponse
- type Channel
- type ChannelEngagement
- type ChannelSubscription
- type ChannelUserInfo
- type CoinBalances
- type CoinReward
- type CoinTransaction
- type CoinTransactionType
- type Condition
- type ConfidenceData
- type Count
- type DBTime
- type Device
- type Devices
- type EngagedUser
- type EngagedUsersByType
- type Engagement
- type ExportedNotification
- type ExportedUser
- type FeatureSwitch
- type FeaturedComment
- type FeaturedComments
- type FeedCacheItem
- type FeedEntriesByID
- type FeedEntry
- type IdentityMap
- type Image
- type Images
- type Invite
- type LeaderboardRank
- type Link
- type Mention
- type Notification
- type NotificationComment
- type NotificationMention
- type OAuthAccount
- type PopularRankEntry
- type Reaction
- type ReactionType
- type ResetToken
- type ScoreModification
- type Session
- type Settings
- type Subscription
- type TaggableUser
- type TippingUser
- type User
- func (u *User) Author() *Author
- func (u *User) CanAffordCost(amount int64) bool
- func (u *User) Export(id globalid.ID) *ExportedUser
- func (u *User) MarshalJSON() ([]byte, error)
- func (u *User) PasswordMatches(password string) (bool, error)
- func (u *User) SetPassword(password string) error
- func (u *User) TaggableUser() TaggableUser
- type UserEngagement
- type UserReaction
- type UserReactionType
- type UserTip
- type Viewer
- type Vote
- type VoteJob
- type VoteResponse
- type VoteType
- type WaitlistEntry
Constants ¶
const ( // Types CommentType = "comment" MentionType = "mention" BoostType = "boost" InviteAcceptedType = "inviteAccepted" AnnouncementType = "announcement" IntroductionType = "introduction" NewInvitesType = "newInvites" FollowType = "follow" CoinsReceivedType = "coinsReceived" PopularPostType = "popularPost" LeaderboardRankType = "leaderboardRank" FirstPostActivityType = "firstPostActivity" // ActionTypes OpenThreadAction = "openThread" // "threadRootID" OpenUserProfileAction = "openProfile" // "username" OpenComposerAction = "openComposer" // "startingPrompt" OpenInvitesAction = "openInvites" // no params OpenWalletAction = "openWallet" )
const ( TimeScalingFactor = 45000.0 PopularRankPower = 0.7 OctoberUnixOffset = 1475280000.0 //these are basically random -- let's revisit these parameters UpvoteMult = 1.0 DownvoteMult = 2.0 CommentMult = 1.5 )
const ( // FacebookProvider is the constant stored in the database to identify // Facebook OAuth 2.0 accounts. FacebookProvider = "facebook" )
const SessionTTL = 30 * 24 * time.Hour
SessionTTL defines the time to live after which a session is expired.
Variables ¶
var ( // AllCardReactions = []ReactionType{Boost, Bury, HighFive, Pass, Seen, Comment, Like, Love, Haha, Wow, Sad, Angry} GraphCardReactions = []ReactionType{UpVote, DownVote, Comment} ExplicitCardReactions = []ReactionType{Boost, Bury} GossipedReactions = []ReactionType{UpVote, DownVote, Comment, Post, UndoComment} CardReactions = []ReactionType{Like, Love, Haha, Wow, Sad, Angry} Votes = []ReactionType{UpVote, DownVote} )
The Card Reactions, from least to most restrictive AllCardReactions is everything the FE can throw into the ReactToCard RPC GraphCardReactions is everything the ReactToCard RPC can throw to the graph ExplicitCardReactions is one-time explicit button press signals tracked by the graph GossipedReactions is reactions which are sent via gossip to all neighbors paying attention
var ( // ErrUsernameTaken is used when a username is validated but it is already in // use by another user. ErrInsufficientBalance = errors.New("not enough coins to pay cost") )
var ErrInvalidInviteCode = errors.New("invalid or expired invite code")
var ErrWrongPassword = errors.New("password did not match")
Functions ¶
func CardReaction ¶
func CardReaction(reaction ReactionType) bool
func ExplicitReaction ¶
func ExplicitReaction(reaction ReactionType) bool
func GossipedReaction ¶
func GossipedReaction(reaction ReactionType) bool
func GraphCardReaction ¶
func GraphCardReaction(reaction ReactionType) bool
func HashPassword ¶
HashPassword hashes the password using bcrypt.
func ValidateChannelName ¶
func ValidateUsername ¶
ValidateUsername checks if the username satisfies the constraints.
func VoteReaction ¶
func VoteReaction(reaction ReactionType) bool
Types ¶
type Activity ¶
type Activity struct { ID globalid.ID `db:"id" json:"-"` RPC string `db:"rpc" json:"rpc"` Data json.RawMessage `db:"data" json:"data,omitempty"` UserID globalid.ID `db:"user_id" json:"userID,omitempty"` Error string `db:"error" json:"error,omitempty"` CreatedAt time.Time `db:"created_at" json:"-"` }
type Announcement ¶
type Announcement struct { ID globalid.ID `db:"id" json:"id"` UserID globalid.ID `db:"from_user" json:"userID"` CardID globalid.ID `db:"card_id" json:"cardID"` Message string `db:"message" json:"message"` //Action string `db:"action" json:"action"` //ActionData AnnouncementActionData `db:"action_data" json:"actionData"` CreatedAt time.Time `db:"created_at" json:"createdAt"` UpdatedAt time.Time `db:"updated_at" json:"updatedAt"` DeletedAt dbTime `db:"deleted_at" json:"deletedAt"` }
type AnnouncementActionData ¶
func (*AnnouncementActionData) Scan ¶
func (d *AnnouncementActionData) Scan(src interface{}) error
func (AnnouncementActionData) UnmarshalJSON ¶
func (d AnnouncementActionData) UnmarshalJSON(b []byte) error
func (AnnouncementActionData) UnmarshalText ¶
func (d AnnouncementActionData) UnmarshalText(text []byte) error
type AnonymousAlias ¶
type AnonymousAlias struct { ID globalid.ID `db:"id"` DisplayName string `db:"display_name"` Username string `db:"username"` ProfileImagePath string `db:"profile_image_path"` CreatedAt time.Time `db:"created_at"` UpdatedAt time.Time `db:"updated_at"` Inactive bool `db:"inactive"` }
func (*AnonymousAlias) Author ¶
func (al *AnonymousAlias) Author() *Author
func (*AnonymousAlias) TaggableUser ¶
func (al *AnonymousAlias) TaggableUser() TaggableUser
type AttentionNode ¶
type Author ¶
type Author struct { ID globalid.ID `db:"id" json:"nodeId,omitempty"` DisplayName string `db:"display_name" json:"displayname"` Username string `db:"username" json:"username"` ProfileImagePath string `db:"profile_image_path" json:"profileimg_path"` IsAnonymous bool `db:"is_anonymous" json:"isAnonymous"` }
Author is what is used on the client and application side to display who wrote a card. This can be a user or an anonymous alias.
type Card ¶
type Card struct { ID globalid.ID `db:"id"` OwnerID globalid.ID `db:"owner_id"` AliasID globalid.ID `db:"alias_id"` ThreadReplyID globalid.ID `db:"thread_reply_id"` ThreadRootID globalid.ID `db:"thread_root_id"` ChannelID globalid.ID `db:"channel_id"` ThreadLevel int `db:"thread_level"` CoinsEarned int `db:"coins_earned"` Title string `db:"title"` Content string `db:"content"` URL string `db:"url"` Anonymous bool `db:"anonymous"` BackgroundImagePath string `db:"background_image_path"` BackgroundColor string `db:"background_color"` AuthorToAlias IdentityMap `db:"author_to_alias"` IsIntroCard bool `db:"is_intro_card"` DeletedAt dbTime `db:"deleted_at"` ShadowbannedAt dbTime `db:"shadowbanned_at"` CreatedAt time.Time `db:"created_at"` UpdatedAt time.Time `db:"updated_at"` Author *Author }
func (*Card) MarshalJSON ¶
type CardReport ¶
type CardReport struct { CardID globalid.ID `json:"cardID" db:"card_id"` UserID globalid.ID `json:"userID" db:"user_id"` CreatedAt time.Time `json:"createdAt" db:"created_at"` UpdatedAt time.Time `json:"updatedAt" db:"updated_at"` }
Mention is an @mention in a card's text.
type CardResponse ¶
type CardResponse struct { Card *CardView `json:"card"` Author *Author `json:"author"` Channel *Channel `json:"channel,omitempty"` Viewer *Viewer `json:"viewer,omitempty"` Replies int `json:"replies"` FeaturedComments *FeaturedComments `json:"featuredComments,omitempty"` Reactions *Reaction `json:"reaction,omitempty"` ViewerReaction *UserReaction `json:"viewerReaction,omitempty"` Engagement *Engagement `json:"engagement,omitempty"` Score int64 `json:"score"` Subscribed bool `json:"subscribed"` IsMine bool `json:"isMine,omitempty"` Vote *VoteResponse `json:"vote,omitempty"` LatestComment *CardResponse `json:"latestComment,omitempty"` RankingReason string `json:"rankingReason,omitempty"` }
type CardView ¶
type CardView struct { ID globalid.ID `json:"cardID"` ThreadReplyID globalid.ID `json:"replyID,omitempty"` ThreadRootID globalid.ID `json:"rootID,omitempty"` ThreadLevel int `json:"threadLevel"` CoinsEarned int `json:"coinsEarned"` Title string `json:"title"` Content string `json:"body"` URL string `json:"url"` BackgroundColor string `json:"bgColor"` BackgroundImagePath string `json:"background_image_path"` Anonymous bool `json:"anonymous"` CreatedAt int64 `json:"post_timestamp"` }
type CardsResponse ¶
type CardsResponse struct { Cards []*CardResponse `json:"cards"` NextPage bool `json:"hasNextPage"` }
type Channel ¶
type Channel struct { ID globalid.ID `db:"id" json:"id"` Name string `db:"name" json:"name"` Description string `db:"description" json:"description"` Private bool `db:"private" json:"private"` OwnerID globalid.ID `db:"owner_id" json:"-"` Handle string `db:"handle" json:"-"` IsDefault bool `db:"is_default" json:"-"` CreatedAt time.Time `db:"created_at" json:"-"` UpdatedAt time.Time `db:"updated_at" json:"-"` }
type ChannelEngagement ¶
type ChannelEngagement struct { ChannelID globalid.ID `db:"channel_id" json:"channelID"` TotalPosts int `db:"total_posts" json:"totalPosts"` TotalLikes int `db:"total_likes" json:"totalLikes"` TotalDislikes int `db:"total_dislikes" json:"totalDislikes"` TotalComments int `db:"total_comments" json:"totalComments"` TotalCommenters int `db:"total_commenters" json:"totalCommenters"` }
type ChannelSubscription ¶
type ChannelUserInfo ¶
type CoinBalances ¶
type CoinReward ¶
type CoinTransaction ¶
type CoinTransaction struct { ID globalid.ID `db:"id"` // ID of user paying coins (null means system generated coins) SourceUserID globalid.ID `db:"source_user_id"` // ID of user getting coins (null means paid to system) RecipientUserID globalid.ID `db:"recipient_user_id"` CardID globalid.ID `db:"card_id"` Amount int `db:"amount"` Type CoinTransactionType `db:"type"` UpdatedAt time.Time `db:"updated_at"` CreatedAt time.Time `db:"created_at"` }
type CoinTransactionType ¶
type CoinTransactionType string
const ( // Initial balance CoinTransactionType_InitialBalance CoinTransactionType = "initialBalance" // Invite transactions // use a code when signing up CoinTransactionType_UsedInvite CoinTransactionType = "usedInvite" // someone uses your code to sign up CoinTransactionType_InviteAccepted CoinTransactionType = "inviteAccepted" // Post transactions // someone liked a post or comment you authored CoinTransactionType_LikeReceived CoinTransactionType = "likeReceived" // someone replied to a post or comment you authored CoinTransactionType_ReplyReceived CoinTransactionType = "replyReceived" // one of your posts performend well CoinTransactionType_FirstPostActivity CoinTransactionType = "firstPostActivity" // one of your posts performend well CoinTransactionType_PopularPost CoinTransactionType = "popularPost" // Someone tipped a post or comment you authored CoinTransactionType_TipGiven CoinTransactionType = "tipGiven" // Leaderboard transactions // placed on the leaderboard CoinTransactionType_LeaderboardFirst CoinTransactionType = "leaderboardFirst" CoinTransactionType_LeaderboardSecond CoinTransactionType = "leaderboardSecond" CoinTransactionType_LeaderboardThird CoinTransactionType = "leaderboardThird" CoinTransactionType_LeaderboardTopTen CoinTransactionType = "leaderboardTopTen" CoinTransactionType_LeaderboardRanked CoinTransactionType = "leaderboardRanked" // Alias transactions // Bought an alias to reply in someone else's thread with CoinTransactionType_BoughtThreadAlias CoinTransactionType = "boughtThreadAlias" // Bought an alias to post a new post with CoinTransactionType_BoughtPostAlias CoinTransactionType = "boughtPostAlias" // Channel transactins // Bought a channel CoinTransactionType_BoughtChannel CoinTransactionType = "boughtChannel" )
type ConfidenceData ¶
type ConfidenceData struct { ID globalid.ID `json:"id"` UpvoteCount int64 `json:"upvoteCount"` DownvoteCount int64 `json:"downvoteCount"` CommentCount int64 `json:"commentCount"` ScoreMod float64 `json:"scoreMod"` ViewCount int64 `json:"viewCount"` Goodness float64 `json:"goodness"` EngagementScore float64 `json:"engagementScore"` Confidence float64 `json:"confidence"` ProbabilitySurfaced float64 `json:"probabilitySurfaced"` Rank float64 `json:"rank"` }
type DBTime ¶
type DBTime struct { WEIRDNAME time.Time //TODO: rename this to Time after upgrading graphql Valid bool }
THIS IS SO FUCKING STUPID WHAT THE FUCK
func (DBTime) MarshalJSON ¶
MarshalJSON marshals the underlying value to a proper JSON representation.
func (*DBTime) UnmarshalJSON ¶
type Device ¶
Device is the representation of the mobile device on which the mobile application is run. The platform specifies the operating system, i.e. Android, iOS.
type EngagedUser ¶
type EngagedUser struct { CardID globalid.ID `db:"card_id" json:"-"` UserID globalid.ID `db:"user_id" json:"userID,omitempty"` AliasID globalid.ID `db:"alias_id" json:"aliasID,omitempty"` ProfileImagePath string `db:"profile_image_path" json:"profileImagePath"` Username string `db:"username" json:"username"` DisplayName string `db:"display_name" json:"displayName"` Type ReactionType `db:"type" json:"type"` CreatedAt time.Time `db:"created_at" json:"-"` }
type EngagedUsersByType ¶
type EngagedUsersByType struct { Like []*EngagedUser `json:"like"` Love []*EngagedUser `json:"love"` Haha []*EngagedUser `json:"haha"` Wow []*EngagedUser `json:"wow"` Sad []*EngagedUser `json:"sad"` Angry []*EngagedUser `json:"angry"` Comment []*EngagedUser `json:"comment"` Tip []*TippingUser `json:"tip"` }
type Engagement ¶
type Engagement struct { EngagedUsers []*EngagedUser `json:"engagedUsers"` EngagedUsersByType EngagedUsersByType `json:"engagedUsersByType"` Count int `json:"count"` CommentCount int `json:"commentCount"` }
type ExportedNotification ¶
type ExportedNotification struct { ID globalid.ID `json:"id"` UserID globalid.ID `json:"userID"` ImagePath string `json:"imagePath"` Message string `json:"message"` Timestamp int64 `json:"timestamp"` Seen bool `json:"seen"` Opened bool `json:"opened"` ShowOnCardID globalid.ID `json:"showOnCardID,omitempty"` Type string `json:"type"` Action string `json:"action"` ActionData map[string]string `json:"actionData"` }
func (*ExportedNotification) PlainMessage ¶
func (eN *ExportedNotification) PlainMessage() string
type ExportedUser ¶
type ExportedUser struct { ID globalid.ID `json:"nodeId,omitempty"` DisplayName string `json:"displayname"` FirstName string `json:"firstName,omitempty"` LastName string `json:"lastName,omitempty"` ProfileImagePath string `json:"profileimg_path"` CoverImagePath string `json:"cover_image_path"` Bio string `json:"userBio"` Email string `json:"email,omitempty"` AllowEmail bool `json:"allow_email,omitempty"` Username string `json:"username"` Devices map[string]Device `json:"devices,omitempty"` Admin bool `json:"admin,omitempty"` SearchKey string `json:"searchKey,omitempty"` BotchedSignup bool `json:"botchedSignup"` CoinBalance int64 `json:"coinBalance,omitempty"` TemporaryCoinBalance int64 `json:"temporaryCoinBalance,omitempty"` }
ExportedUser is a subset of user. This type exists in order to hide sensitive information.
func (*ExportedUser) Import ¶
func (eu *ExportedUser) Import() *User
type FeatureSwitch ¶
type FeatureSwitch struct { ID globalid.ID `db:"id"` Name string `db:"name"` State string `db:"state"` // off, testing, on TestingUsers testingusers `db:"testing_users"` CreatedAt time.Time `db:"created_at"` UpdatedAt time.Time `db:"updated_at"` }
A link is a URI saved by a user on the client for later retrieval.
type FeaturedComment ¶
type FeaturedComments ¶
type FeaturedComments struct {
Comments []*FeaturedComment
}
type FeedCacheItem ¶
type FeedEntriesByID ¶
type FeedEntry ¶
type FeedEntry struct { ID globalid.ID `db:"id"` UserID globalid.ID `db:"user_id"` CardID globalid.ID `db:"card_id"` FeedSessionIndex int `db:"feed_session_index"` FeedSessionRank int `db:"feed_session_rank"` LastRankedAt dbTime `db:"last_ranked_at"` RerankedAt dbTime `db:"reranked_at"` LastNewContentAt dbTime `db:"last_new_content_at"` CreatedAt time.Time `db:"created_at"` UpdatedAt time.Time `db:"updated_at"` }
func ToFeedEntries ¶
func ToFeedEntries(cacheItems []*FeedCacheItem, newCardIDs []globalid.ID) []*FeedEntry
func (FeedEntry) EarlierInFeed ¶
type IdentityMap ¶
func (*IdentityMap) Scan ¶
func (d *IdentityMap) Scan(src interface{}) error
type Image ¶
Image is a representation of an image hosted on the static file server of the backend, i.e. card image, profile image.
type Invite ¶
type Invite struct { ID globalid.ID `db:"id" json:"-"` NodeID globalid.ID `db:"node_id" json:"node_id"` ChannelID globalid.ID `db:"channel_id" json:"-"` Token string `db:"token" json:"token"` RemainingUses int `db:"remaining_uses" json:"remaining_uses"` HideFromUser bool `db:"hide_from_user" json:"-"` SystemInvite bool `db:"system_invite" json:"-"` GroupID globalid.ID `db:"group_id" json:"-"` CreatedAt time.Time `db:"created_at" json:"created_at"` UpdatedAt time.Time `db:"updated_at" json:"updated_at"` }
type LeaderboardRank ¶
type Link ¶
type Link struct { ID globalid.ID `json:"id"` URL string `json:"url"` Username string `json:"username"` }
A link is a URI saved by a user on the client for later retrieval.
type Mention ¶
type Mention struct { ID globalid.ID `json:"id" db:"id"` InCard globalid.ID `json:"inCard" db:"in_card"` MentionedUser globalid.ID `json:"mentionedUser" db:"mentioned_user"` MentionedAlias globalid.ID `json:"mentionedAlias" db:"mentioned_alias"` CreatedAt time.Time `json:"createdAt" db:"created_at"` UpdatedAt time.Time `json:"updatedAt" db:"updated_at"` DeletedAt dbTime `json:"deletedAt" db:"deleted_at"` }
Mention is an @mention in a card's text.
type Notification ¶
type Notification struct { ID globalid.ID `db:"id"` UserID globalid.ID `db:"user_id"` TargetID globalid.ID `db:"target_id"` TargetAliasID globalid.ID `db:"target_alias_id"` Type string `db:"type"` SeenAt dbTime `db:"seen_at"` OpenedAt dbTime `db:"opened_at"` CreatedAt time.Time `db:"created_at"` UpdatedAt time.Time `db:"updated_at"` DeletedAt dbTime `db:"deleted_at"` }
func (*Notification) MarshalJSON ¶
func (n *Notification) MarshalJSON() ([]byte, error)
type NotificationComment ¶
type NotificationMention ¶
type NotificationMention struct { NotificationID globalid.ID `json:"notificationID" db:"notification_id"` MentionID globalid.ID `json:"mentionID" db:"mention_id"` CreatedAt time.Time `json:"createdAt" db:"created_at"` UpdatedAt time.Time `json:"updatedAt" db:"updated_at"` }
links notifications and mentions
type OAuthAccount ¶
type OAuthAccount struct { ID globalid.ID `db:"id"` Provider string `db:"provider"` Subject string `db:"subject"` UserID globalid.ID `db:"user_id"` CreatedAt time.Time `db:"created_at"` UpdatedAt time.Time `db:"updated_at"` }
OAuthAccount tracks the user accounts which have been authorized via a OAuth 2.0 provider. This information is required in order to allow for subsequent authentications to identify the associated user again.
func NewOAuthAccount ¶
func NewOAuthAccount(provider, subject string, userID globalid.ID) *OAuthAccount
NewOAuthAccount returns a new instance of OAuthAccount.
type PopularRankEntry ¶
type PopularRankEntry struct { CardID globalid.ID `db:"card_id"` Views int64 `db:"views"` UpvoteCount int64 `db:"upvote_count"` DownvoteCount int64 `db:"downvote_count"` CommentCount int64 `db:"comment_count"` UniqueCommentersCount int64 `db:"unique_commenters_count"` ScoreMod float64 `db:"score_mod"` CreatedAtTimestamp int64 `db:"created_at_timestamp"` }
func (PopularRankEntry) Rank ¶
func (entry PopularRankEntry) Rank() float64
type Reaction ¶
type Reaction struct { ID globalid.ID `db:"id" json:"id"` NodeID globalid.ID `db:"node_id" json:"nodeID"` AliasID globalid.ID `db:"alias_id" json:"aliasID,omitempty"` CardID globalid.ID `db:"card_id" json:"cardID"` Reaction ReactionType `db:"reaction" json:"reaction"` CreatedAt time.Time `db:"created_at" json:"createdAt"` UpdatedAt time.Time `db:"updated_at" json:"updatedAt"` }
type ReactionType ¶
type ReactionType string
const ( Boost ReactionType = "boost" Bury ReactionType = "bury" HighFive ReactionType = "highfive" Pass ReactionType = "pass" Seen ReactionType = "seen" Comment ReactionType = "comment" Like ReactionType = "like" Love ReactionType = "love" Haha ReactionType = "haha" Wow ReactionType = "wow" Sad ReactionType = "sad" Angry ReactionType = "angry" UpVote ReactionType = "up" DownVote ReactionType = "down" Post ReactionType = "post" ScoreMod ReactionType = "scoremod" Offset ReactionType = "offset" UndoComment ReactionType = "undoComment" )
func FromVote ¶
func FromVote(vote VoteType) ReactionType
type ResetToken ¶
type ResetToken struct { Token globalid.ID `db:"-" json:"token"` TokenHash string `db:"token_hash" json:"tokenHash"` UserID globalid.ID `db:"user_id" json:"userID"` Expires time.Time `db:"expires" json:"expires"` CreatedAt time.Time `db:"created_at" json:"created_at"` UpdatedAt time.Time `db:"updated_at" json:"updated_at"` }
ResetToken represents a password reset triggered by a user.
func NewResetToken ¶
func NewResetToken(userID globalid.ID) (*ResetToken, error)
NewResetToken returns a new instance of ResetToken.
func (*ResetToken) Valid ¶
func (rt *ResetToken) Valid() error
Valid checks whether the reset password is still valid. A token to reset the password should only be valid for a fixed timespan.
type ScoreModification ¶
type Session ¶
type Session struct { ID globalid.ID `db:"id" json:"id"` UserID globalid.ID `db:"user_id" json:"userID,omitempty"` CreatedAt time.Time `db:"created_at" json:"-"` UpdatedAt time.Time `db:"updated_at" json:"-"` sync.RWMutex User *User `db:"user" json:"user,omitempty"` }
Session identifies an authenticated user.
func NewSession ¶
NewSession returns a new instance of session with a unique identifier.
func (*Session) Authenticated ¶
func (*Session) GetUser ¶
User returns the user attached to the session. This method is thread-safe as it is accessed for every authenticated RPC action.
type Subscription ¶
type Subscription struct { UserID globalid.ID `json:"userID" db:"user_id"` CardID globalid.ID `json:"cardID" db:"card_id"` Type string `json:"type" db:"type"` CreatedAt time.Time `json:"createdAt" db:"created_at"` UpdatedAt time.Time `json:"updatedAt" db:"updated_at"` }
A link is a URI saved by a user on the client for later retrieval.
type TaggableUser ¶
type TippingUser ¶
type TippingUser struct { TipID globalid.ID `db:"tip_id" json:"tipID"` UserID globalid.ID `db:"user_id" json:"userID,omitempty"` AliasID globalid.ID `db:"alias_id" json:"aliasID,omitempty"` Anonymous bool `db:"anonymous" json:"anonymous"` ProfileImagePath string `db:"profile_image_path" json:"profileImagePath"` Username string `db:"username" json:"username"` DisplayName string `db:"display_name" json:"displayName"` Amount int `db:"amount" json:"amount"` CreatedAt time.Time `db:"created_at" json:"-"` }
type User ¶
type User struct { ID globalid.ID `db:"id" json:"nodeId,omitempty"` DisplayName string `db:"display_name" json:"displayname"` FirstName string `db:"first_name" json:"firstName,omitempty"` LastName string `db:"last_name" json:"lastName,omitempty"` ProfileImagePath string `db:"profile_image_path" json:"profileimg_path"` CoverImagePath string `db:"cover_image_path" json:"cover_image_path"` Bio string `db:"bio" json:"userBio,omitempty"` Email string `db:"email" json:"email,omitempty"` PasswordHash string `db:"password_hash"` PasswordSalt string `db:"password_salt"` Username string `db:"username" json:"username"` Devices Devices `db:"devices" json:"devices,omitempty"` Admin bool `db:"admin" json:"admin,omitempty"` AllowEmail bool `db:"allow_email" json:"allow_email"` SearchKey string `db:"search_key" json:"searchKey,omitempty"` FeedUpdatedAt dbTime `db:"feed_updated_at"` JoinedFromInvite globalid.ID `db:"joined_from_invite" json:"joinedFromInvite"` BotchedSignup bool `db:"botched_signup" json:"botchedSignup"` PossibleUninstall bool `db:"possible_uninstall" json:"possibleUninstall"` GotDelayedInvites bool `db:"got_delayed_invites" json:"-"` DisableFeed bool `db:"disable_feed" json:"-"` IsVerified bool `db:"is_verified" json:"-"` IsInternal bool `db:"is_internal" json:"-"` CoinBalance int64 `db:"coin_balance" json:"-"` TemporaryCoinBalance int64 `db:"temporary_coin_balance" json:"-"` CoinRewardLastUpdatedAt dbTime `db:"coin_reward_last_updated_at" json:"-"` IsDefault bool `db:"is_default" json:"-"` SeenIntroCards bool `db:"seen_intro_cards" json:"-"` CreatedAt time.Time `db:"created_at"` UpdatedAt time.Time `db:"updated_at" json:"updatedAt"` DeletedAt dbTime `db:"deleted_at"` FeedLastUpdatedAt dbTime `db:"feed_last_updated_at"` ShadowbannedAt dbTime `db:"shadowbanned_at"` BlockedAt dbTime `db:"blocked_at" json:"blockedAt"` }
func (*User) CanAffordCost ¶
func (*User) Export ¶
func (u *User) Export(id globalid.ID) *ExportedUser
Export exports the user by copying the existing fields to the target fields of ExportedUser. Based on the given user ID more or less fields are exported.
func (*User) MarshalJSON ¶
func (*User) PasswordMatches ¶
PasswordMatches validates whether the given password is the same as the password stored in the user.
func (*User) SetPassword ¶
SetPassword assigns a new password by hashing it.
func (*User) TaggableUser ¶
func (u *User) TaggableUser() TaggableUser
type UserEngagement ¶
type UserEngagement struct { UserID globalid.ID `json:"userID"` DaysActive int `json:"daysActive"` PostCount int `json:"postCount"` CommentCount int `json:"commentCount"` ReactedCount int `json:"reactedCount"` ReceivedReactionsCount int `json:"receivedReactionsCount"` FollowedUsersCount int `json:"followedUsersCount"` FollowedCount int `json:"followedCount"` InvitedCount int `json:"invitedCount"` Score float64 `json:"score"` }
type UserReaction ¶
type UserReaction struct { UserID globalid.ID `db:"user_id" json:"userID"` CardID globalid.ID `db:"card_id" json:"cardID"` AliasID globalid.ID `db:"alias_id" json:"aliasID,omitempty"` Type UserReactionType `db:"type" json:"type"` CreatedAt time.Time `db:"created_at" json:"createdAt"` UpdatedAt time.Time `db:"updated_at" json:"updatedAt"` }
func (*UserReaction) ToCardReaction ¶
func (ur *UserReaction) ToCardReaction() *Reaction
func (*UserReaction) ToVoteResponse ¶
func (ur *UserReaction) ToVoteResponse() *VoteResponse
type UserReactionType ¶
type UserReactionType string
const ( UserReactionsTableName = "user_reactions" ReactionLike UserReactionType = "like" ReactionDislike UserReactionType = "dislike" )
type UserTip ¶
type UserTip struct { ID globalid.ID `db:"id" json:"id"` UserID globalid.ID `db:"user_id" json:"userID"` CardID globalid.ID `db:"card_id" json:"cardID"` AliasID globalid.ID `db:"alias_id" json:"aliasID"` Anonymous bool `db:"anonymous" json:"anonymous"` Amount int `db:"amount" json:"amount"` CreatedAt time.Time `db:"created_at" json:"-"` UpdatedAt time.Time `db:"updated_at" json:"-"` }
type Viewer ¶
type Viewer struct { AnonymousAlias *AnonymousAlias `json:"alias,omitempty"` AnonymousAliasLastUsed bool `json:"aliasLastUsed"` }
type Vote ¶
type Vote struct { CardID globalid.ID `db:"card_id" json:"cardID"` UserID globalid.ID `db:"user_id" json:"userID"` Strength float64 `db:"strength" json:"strength"` SentToGraph bool `db:"sent_to_graph" json:"sentToGraph"` Type VoteType `db:"type" json:"type"` CreatedAt time.Time `db:"created_at" json:"createdAt"` }
type VoteJob ¶
type VoteResponse ¶
type VoteResponse struct {
Type string `json:"type"`
}
Source Files ¶
- activity.go
- announcements.go
- anonymous_alias.go
- attentionnode.go
- author.go
- card.go
- card_report.go
- channel.go
- coin_rewards.go
- coin_transactions.go
- device.go
- engagement.go
- featureswitch.go
- feed_cache.go
- feed_entry.go
- images.go
- invite.go
- leaderboard_ranks.go
- link.go
- mentions.go
- notifications.go
- oauthaccount.go
- popular_ranks.go
- reaction.go
- resettoken.go
- score_modification.go
- session.go
- settings.go
- stats.go
- subscriptions.go
- time.go
- user.go
- user_reactions.go
- user_tips.go
- vote.go
- votejob.go
- waitlist.go