Documentation
¶
Overview ¶
TODO finish
TODO finish
Index ¶
- Constants
- Variables
- func DetermineUserRenownLevel(value uint64) (TierType, LevelType, uint64, uint64)
- type Attempt
- type AttemptFrontend
- type AttemptSQL
- type AuthenticationRole
- type AutoGitSettings
- type AvatarSettings
- type Award
- type AwardFrontend
- type AwardSQL
- type BroadcastEvent
- type BroadcastEventFrontend
- type BroadcastEventSQL
- type BroadcastType
- type ChallengeType
- type Chat
- type ChatFrontend
- type ChatIconInfo
- type ChatMessage
- type ChatMessageFrontend
- type ChatMessageSQL
- type ChatMessageType
- type ChatSQL
- type ChatType
- type CodeSource
- type Coffee
- type CoffeeFrontend
- type CoffeeSQL
- type Comment
- type CommentBackground
- type CommentBackgroundFrontend
- type CommentBackgroundSQL
- type CommentFrontend
- type CommentSQL
- type CommunicationType
- type ContentType
- type CuratedPost
- type CuratedPostFrontend
- type CuratedPostSQL
- type DailyUsage
- type Discussion
- type DiscussionBackground
- type DiscussionBackgroundFrontend
- type DiscussionBackgroundSQL
- type DiscussionFrontend
- type DiscussionSQL
- type ExclusiveContentPurchases
- type ExclusiveContentPurchasesFrontend
- type ExclusiveContentPurchasesSQL
- type Follower
- type FollowerFrontend
- type FollowerSQL
- type FriendRequests
- type FriendRequestsFrontend
- type FriendRequestsSQL
- type Friends
- type FriendsFrontend
- type FriendsSQL
- type ImplicitAction
- type ImplicitRec
- type ImplicitRecFrontend
- type ImplicitRecSQL
- type LevelType
- type Nemesis
- type NemesisFrontend
- type NemesisHistory
- type NemesisSQL
- type Notification
- type NotificationFrontend
- type NotificationSQL
- type NotificationType
- type OverAllocated
- type Post
- type PostFrontend
- type PostSQL
- type PostVisibility
- type ProficiencyType
- type ProgrammingLanguage
- type RankType
- type RecommendationType
- type RecommendedPost
- type RecommendedPostFrontend
- type RecommendedPostSQL
- type Renown10Struct
- type Renown1Struct
- type Renown2Struct
- type Renown3Struct
- type Renown4Struct
- type Renown5Struct
- type Renown6Struct
- type Renown7Struct
- type Renown8Struct
- type Renown9Struct
- type ReportIssue
- type ReportIssueFrontend
- type ReportIssueSQL
- type Rewards
- type RewardsFrontend
- type RewardsSQL
- type SQLInsertStatement
- type SearchRec
- type SearchRecFrontend
- type SearchRecSQL
- type StatsXP
- type Tag
- type TagFrontend
- type TagSQL
- type TagSearch
- type ThreadComment
- type ThreadCommentFrontend
- type ThreadCommentSQL
- type ThreadReply
- type ThreadReplyFrontend
- type ThreadReplySQL
- type TierType
- type UpVote
- type UpVoteFrontend
- type UpVoteSQL
- type User
- func (i *User) EditUser(userName *string, password *string, email *string, phone *string, ...) (*User, *SQLInsertStatement, error)
- func (i *User) GenerateUserOtpUri(db *ti.Database) (map[string]interface{}, error)
- func (i *User) ToFrontend() (*UserFrontend, error)
- func (i *User) ToSQLNative() ([]*SQLInsertStatement, error)
- func (i *User) ToSearch() *UserSearch
- func (i *User) VerifyUserOtp(db *ti.Database, storageEngine storage.Storage, otp string, ip string) (map[string]interface{}, string, error)
- type UserFreePremium
- type UserFreePremiumSQL
- type UserFrontend
- type UserRewardsInventory
- type UserSQL
- type UserSearch
- type UserSession
- type UserSessionKey
- type UserStart
- type UserStats
- type UserStatsFrontend
- type UserStatsSQL
- type UserStatus
- type UserTutorial
- type VolpoolVolume
- type VolumeState
- type Workspace
- type WorkspaceAgent
- type WorkspaceAgentState
- type WorkspaceAgentStats
- type WorkspaceAgentStatsSQL
- type WorkspaceConfig
- type WorkspaceConfigFrontend
- type WorkspaceConfigSQL
- type WorkspaceFrontend
- type WorkspaceInitFailure
- type WorkspaceInitState
- type WorkspacePort
- type WorkspacePortFrontend
- type WorkspaceSQL
- type WorkspaceSettings
- type WorkspaceState
- type XPBoost
- type XPBoostFrontend
- type XPBoostSQL
- type XPReason
- type XPReasonFrontend
- type XPReasonSQL
Constants ¶
View Source
const ( Beginner = iota Intermediate Advanced Any )
View Source
const ( ImplicitTypeAttemptStart = iota ImplicitTypeAttemptEnd ImplicitTypeChallengeStart ImplicitTypeChallengeEnd ImplicitTypeInteractiveStart ImplicitTypeClicked ImplicitTypeClickedOff ImplicitTypeClickedOwnedProject ImplicitTypeClickedOffOwnedProject ImplicitTypeOwnedProjectStart ImplicitTypeOwnedProjectEnd ImplicitTypeInteractiveEnd )
View Source
const ( RecommendationTypeSematic = iota RecommendationTypeCollaborative RecommendationTypeHybrid )
Variables ¶
View Source
var DefaultAutoGitSettings = AutoGitSettings{ RunOnStart: true, UpdateInterval: 18, Logging: true, Silent: false, CommitMessage: "--- Auto Git Commit ---", Locale: "en-US", TimeZone: "America/Chicago", }
View Source
var DefaultAvatarSettings = AvatarSettings{
TopType: "ShortHairDreads02",
AccessoriesType: "Prescription02",
HairColor: "BrownDark",
FacialHairType: "Blank",
ClotheType: "Hoodie",
ClotheColor: "PastelBlue",
EyeType: "Happy",
EyebrowType: "Default",
MouthType: "Smile",
AvatarStyle: "Circle",
SkinColor: "Light",
}
View Source
var DefaultAvatarSettingsInfo = DefaultAvatarSettings
View Source
var DefaultStartUserInfo = DefaultUserStart
View Source
var DefaultUserStart = UserStart{
Usage: "",
Proficiency: "",
Tags: "",
PreferredLanguage: "",
}
View Source
var DefaultUserTutorial = UserTutorial{}
View Source
var DefaultWorkspaceSettings = WorkspaceSettings{ AutoGit: DefaultAutoGitSettings, }
Functions ¶
Types ¶
type Attempt ¶
type Attempt struct { ID int64 `json:"_id" sql:"_id"` PostTitle string `json:"post_title" sql:"post_title"` Description string `json:"description" sql:"description"` Author string `json:"author" sql:"author"` AuthorID int64 `json:"author_id" sql:"author_id"` CreatedAt time.Time `json:"created_at" sql:"created_at"` UpdatedAt time.Time `json:"updated_at" sql:"updated_at"` RepoID int64 `json:"repo_id" sql:"repo_id"` AuthorTier TierType `json:"author_tier" sql:"author_tier"` //Awards []int64 `json:"awards" sql:"awards"` Coffee uint64 `json:"coffee" sql:"coffee"` PostID int64 `json:"post_id" sql:"post_id"` Closed bool `json:"closed" sql:"closed"` Success bool `json:"success" sql:"success"` ClosedDate *time.Time `json:"closed_date" sql:"closed_date"` Tier TierType `json:"tier" sql:"tier"` ParentAttempt *int64 `json:"parent_attempt" sql:"parent_attempt"` WorkspaceSettings *WorkspaceSettings `json:"workspace_settings" sql:"workspace_settings"` PostType ChallengeType `json:"post_type" sql:"post_type"` }
func AttemptFromSQLNative ¶
func CreateAttempt ¶
func (*Attempt) ToFrontend ¶
func (i *Attempt) ToFrontend() *AttemptFrontend
func (*Attempt) ToSQLNative ¶
func (i *Attempt) ToSQLNative() ([]*SQLInsertStatement, error)
type AttemptFrontend ¶
type AttemptFrontend struct { ID string `json:"_id" sql:"_id"` PostTitle string `json:"post_title" sql:"post_title"` Description string `json:"description" sql:"description"` Author string `json:"author" sql:"author"` AuthorID string `json:"author_id" sql:"author_id"` CreatedAt time.Time `json:"created_at" sql:"created_at"` UpdatedAt time.Time `json:"updated_at" sql:"updated_at"` RepoID string `json:"repo_id" sql:"repo_id"` AuthorTier TierType `json:"author_tier" sql:"author_tier"` //Awards []string `json:"awards" sql:"awards"` Coffee string `json:"coffee" sql:"coffee"` PostID string `json:"post_id" sql:"post_id"` Closed bool `json:"closed" sql:"closed"` Success bool `json:"success" sql:"success"` ClosedDate *time.Time `json:"closed_date" sql:"closed_date"` Tier TierType `json:"tier" sql:"tier"` ParentAttempt *string `json:"parent_attempt" sql:"parent_attempt"` Thumbnail string `json:"thumbnail"` PostType ChallengeType `json:"post_type" sql:"post_type"` PostTypeString string `json:"post_type_string" sql:"post_type_string"` }
type AttemptSQL ¶
type AttemptSQL struct { ID int64 `json:"_id" sql:"_id"` PostTitle string `json:"post_title" sql:"post_title"` Description string `json:"description" sql:"description"` Author string `json:"author" sql:"author"` AuthorID int64 `json:"author_id" sql:"author_id"` CreatedAt time.Time `json:"created_at" sql:"created_at"` UpdatedAt time.Time `json:"updated_at" sql:"updated_at"` RepoID int64 `json:"repo_id" sql:"repo_id"` AuthorTier TierType `json:"author_tier" sql:"author_tier"` //Awards []byte `json:"awards" sql:"awards"` Coffee uint64 `json:"coffee" sql:"coffee"` PostID int64 `json:"post_id" sql:"post_id"` Closed bool `json:"closed" sql:"closed"` Success bool `json:"success" sql:"success"` ClosedDate *time.Time `json:"closed_date" sql:"closed_date"` Tier TierType `json:"tier" sql:"tier"` ParentAttempt *int64 `json:"parent_attempt" sql:"parent_attempt"` WorkspaceSettings []byte `json:"workspace_settings" sql:"workspace_settings"` PostType ChallengeType `json:"post_type" sql:"post_type"` }
type AuthenticationRole ¶
type AuthenticationRole int64
const ( BaseUser AuthenticationRole = iota Admin )
func (AuthenticationRole) String ¶
func (r AuthenticationRole) String() string
type AutoGitSettings ¶
type AvatarSettings ¶
type AvatarSettings struct { TopType string `json:"topType"` AccessoriesType string `json:"accessoriesType"` HairColor string `json:"hairColor"` FacialHairType string `json:"facialHairType"` ClotheType string `json:"clotheType"` ClotheColor string `json:"clotheColor"` EyeType string `json:"eyeType"` EyebrowType string `json:"eyebrowType"` MouthType string `json:"mouthType"` AvatarStyle string `json:"avatarStyle"` SkinColor string `json:"skinColor"` }
type Award ¶
type Award struct { ID int64 `json:"_id" sql:"_id"` Award string `json:"award" sql:"award"` Types ContentType `json:"type" sql:"type"` }
func CreateAward ¶
func CreateAward(id int64, award string, types ContentType) (*Award, error)
func (*Award) ToFrontend ¶
func (i *Award) ToFrontend() *AwardFrontend
func (*Award) ToSQLNative ¶
func (i *Award) ToSQLNative() *SQLInsertStatement
type AwardFrontend ¶
type AwardFrontend struct { ID string `json:"_id" sql:"_id"` Award string `json:"award" sql:"award"` Types ContentType `json:"type" sql:"type"` }
type AwardSQL ¶
type AwardSQL struct { ID int64 `json:"_id" sql:"_id"` Award string `json:"award" sql:"award"` Types ContentType `json:"type" sql:"type"` }
type BroadcastEvent ¶
type BroadcastEvent struct { ID int64 `json:"_id" sql:"_id"` UserID int64 `json:"user_id" sql:"user_id"` UserName string `json:"user_name" sql:"user_name"` Message string `json:"message" sql:"message"` BroadcastType BroadcastType `json:"broadcast_type" sql:"broadcast_type"` TimePosted time.Time `json:"time_posted" sql:"time_posted"` }
func BroadcastEventFromSQLNative ¶
func BroadcastEventFromSQLNative(rows *sql.Rows) (*BroadcastEvent, error)
func CreateBroadcastEvent ¶
func CreateBroadcastEvent(id int64, userID int64, userName string, message string, broadcastType BroadcastType, date time.Time) (*BroadcastEvent, error)
func (*BroadcastEvent) ToFrontend ¶
func (i *BroadcastEvent) ToFrontend() *BroadcastEventFrontend
func (*BroadcastEvent) ToSQLNative ¶
func (i *BroadcastEvent) ToSQLNative() *SQLInsertStatement
type BroadcastEventFrontend ¶
type BroadcastEventFrontend struct { ID string `json:"_id" sql:"_id"` UserID string `json:"user_id" sql:"user_id"` UserName string `json:"user_name" sql:"user_name"` Message string `json:"message" sql:"message"` BroadcastType BroadcastType `json:"broadcast_type" sql:"broadcast_type"` TimePosted time.Time `json:"time_posted" sql:"time_posted"` }
type BroadcastEventSQL ¶
type BroadcastEventSQL struct { ID int64 `json:"_id" sql:"_id"` UserID int64 `json:"user_id" sql:"user_id"` UserName string `json:"user_name" sql:"user_name"` Message string `json:"message" sql:"message"` BroadcastType BroadcastType `json:"broadcast_type" sql:"broadcast_type"` TimePosted time.Time `json:"time_posted" sql:"time_posted"` }
type BroadcastType ¶
type BroadcastType int
const ( BroadcastMessage BroadcastType = iota BroadcastNotification )
func (BroadcastType) String ¶
func (b BroadcastType) String() string
type ChallengeType ¶
type ChallengeType int
const ( InteractiveChallenge ChallengeType = iota PlaygroundChallenge CasualChallenge CompetitiveChallenge )
func (ChallengeType) String ¶
func (c ChallengeType) String() string
type Chat ¶
type Chat struct { ID int64 `json:"_id" sql:"_id"` Name string `json:"name" sql:"name"` Type ChatType `json:"type" sql:"type"` Users []int64 `json:"users" sql:"users"` Usernames []string `json:"user_names" sql:"user_names"` LastMessage *int64 `json:"last_message" sql:"last_message"` LastMessageTime *time.Time `json:"last_message_time" sql:"last_message_time"` ChatIconInfo *ChatIconInfo `json:"icon" sql:"icon"` LastReadMessage *int64 `json:"last_read_message" sql:"last_read_message"` Muted bool `json:"muted" sql:"muted"` }
func ChatFromSQLNative ¶
func (*Chat) ToFrontend ¶
func (c *Chat) ToFrontend() *ChatFrontend
func (*Chat) ToSQLNative ¶
func (c *Chat) ToSQLNative() []SQLInsertStatement
type ChatFrontend ¶
type ChatFrontend struct { ID string `json:"_id" sql:"_id"` Name string `json:"name" sql:"name"` Type ChatType `json:"type" sql:"type"` Users []string `json:"users" sql:"users"` UserNames []string `json:"user_names" sql:"user_names"` LastMessage *string `json:"last_message" sql:"last_message"` LastMessageTime *time.Time `json:"last_message_time" sql:"last_message_time"` ChatIconInfo *ChatIconInfo `json:"icon" sql:"icon"` LastReadMessage *string `json:"last_read_message" sql:"last_read_message"` Muted bool `json:"muted" sql:"muted"` }
type ChatIconInfo ¶
type ChatIconInfo struct { Icon string `json:"icon" sql:"icon"` Background string `json:"background" sql:"background"` BackgroundRenderInFront bool `json:"background_render_in_front" sql:"background_render_in_front"` BackgroundPalette string `json:"background_palette" sql:"background_palette"` Pro bool `json:"pro" sql:"pro"` }
type ChatMessage ¶
type ChatMessage struct { ID int64 `json:"_id" sql:"_id"` ChatID int64 `json:"chat_id" sql:"chat_id"` AuthorID int64 `json:"author_id" sql:"author_id"` Author string `json:"author" sql:"author"` Message string `json:"message" sql:"message"` CreatedAt time.Time `json:"created_at" sql:"created_at"` Revision int64 `json:"revision" sql:"revision"` Type ChatMessageType `json:"type" sql:"type"` // Join fields - not included in the model but common for queries AuthorRenown TierType `json:"author_renown" sql:"author_renown"` }
func ChatMessageFromSQLNative ¶
func ChatMessageFromSQLNative(rows *sql.Rows) (*ChatMessage, error)
func CreateChatMessage ¶
func CreateChatMessage(id int64, chatID int64, authorID int64, author string, message string, createdAt time.Time, revision int64, messageType ChatMessageType) *ChatMessage
func (*ChatMessage) ToFrontend ¶
func (i *ChatMessage) ToFrontend() *ChatMessageFrontend
func (*ChatMessage) ToSQLNative ¶
func (i *ChatMessage) ToSQLNative() *SQLInsertStatement
type ChatMessageFrontend ¶
type ChatMessageFrontend struct { ID string `json:"_id" sql:"_id"` ChatID string `json:"chat_id" sql:"chat_id"` AuthorID string `json:"author_id" sql:"author_id"` Author string `json:"author" sql:"author"` Message string `json:"message" sql:"message"` CreatedAt time.Time `json:"created_at" sql:"created_at"` Revision int64 `json:"revision" sql:"revision"` Type ChatMessageType `json:"type" sql:"type"` // Join fields - not included in the model but common for queries AuthorRenown TierType `json:"author_renown" sql:"author_renown"` }
type ChatMessageSQL ¶
type ChatMessageSQL struct { ID int64 `json:"_id" sql:"_id"` ChatID int64 `json:"chat_id" sql:"chat_id"` AuthorID int64 `json:"author_id" sql:"author_id"` Author string `json:"author" sql:"author"` Message string `json:"message" sql:"message"` CreatedAt time.Time `json:"created_at" sql:"created_at"` Revision int64 `json:"revision" sql:"revision"` Type ChatMessageType `json:"type" sql:"type"` // Join fields - not included in the model but common for queries AuthorRenown TierType `json:"author_renown" sql:"author_renown"` }
type ChatMessageType ¶
type ChatMessageType int
const ( ChatMessageTypeInsecure ChatMessageType = iota ChatMessageTypeSecure )
type ChatSQL ¶
type ChatSQL struct { ID int64 `json:"_id" sql:"_id"` Name string `json:"name" sql:"name"` Type ChatType `json:"type" sql:"type"` Users []int64 `json:"users" sql:"users"` Usernames []string `json:"user_names" sql:"user_names"` LastMessage *int64 `json:"last_message" sql:"last_message"` LastMessageTime *time.Time `json:"last_message_time" sql:"last_message_time"` }
type CodeSource ¶
type CodeSource int
const ( CodeSourcePost CodeSource = iota CodeSourceAttempt )
func (CodeSource) String ¶
func (s CodeSource) String() string
type Coffee ¶
type Coffee struct { ID int64 `json:"_id" sql:"_id"` UserID int64 `json:"user_id" sql:"user_id"` CreatedAt time.Time `json:"created_at" sql:"created_at"` UpdatedAt time.Time `json:"updated_at" sql:"updated_at"` AttemptID *int64 `json:"attempt_id" sql:"attempt_id"` PostID *int64 `json:"post_id" sql:"post_id"` DiscussionID *int64 `json:"discussion_id" sql:"discussion_id"` }
func CreateCoffee ¶
func (*Coffee) ToFrontend ¶
func (i *Coffee) ToFrontend() *CoffeeFrontend
func (*Coffee) ToSQLNative ¶
func (i *Coffee) ToSQLNative() *SQLInsertStatement
type CoffeeFrontend ¶
type CoffeeFrontend struct { ID string `json:"_id" sql:"_id"` UserID string `json:"user_id" sql:"user_id"` CreatedAt time.Time `json:"created_at" sql:"created_at"` UpdatedAt time.Time `json:"updated_at" sql:"updated_at"` AttemptID *string `json:"attempt_id" sql:"attempt_id"` PostID *string `json:"post_id" sql:"post_id"` DiscussionID *string `json:"discussion_id" sql:"discussion_id"` }
type CoffeeSQL ¶
type CoffeeSQL struct { ID int64 `json:"_id" sql:"_id"` UserID int64 `json:"user_id" sql:"user_id"` CreatedAt time.Time `json:"created_at" sql:"created_at"` UpdatedAt time.Time `json:"updated_at" sql:"updated_at"` AttemptID *int64 `json:"attempt_id" sql:"attempt_id"` PostID *int64 `json:"post_id" sql:"post_id"` DiscussionID *int64 `json:"discussion_id" sql:"discussion_id"` }
type Comment ¶
type Comment struct { ID int64 `json:"_id" sql:"_id"` Body string `json:"body" sql:"body"` Author string `json:"author" sql:"author"` AuthorID int64 `json:"author_id" sql:"author_id"` CreatedAt time.Time `json:"created_at" sql:"created_at"` AuthorTier TierType `json:"author_tier" sql:"author_tier"` Awards []int64 `json:"awards" sql:"awards"` Coffee uint64 `json:"coffee" sql:"coffee"` DiscussionId int64 `json:"discussion_id" sql:"discussion_id"` Leads bool `json:"leads" sql:"leads"` Revision int `json:"revision" sql:"revision"` DiscussionLevel CommunicationType `json:"discussion_level" sql:"discussion_level"` }
func CommentFromSQLNative ¶
func CreateComment ¶
func (*Comment) ToFrontend ¶
func (i *Comment) ToFrontend() *CommentFrontend
func (*Comment) ToSQLNative ¶
func (i *Comment) ToSQLNative() []*SQLInsertStatement
type CommentBackground ¶
type CommentBackground struct { ID int64 `json:"_id" sql:"_id"` Body string `json:"body" sql:"body"` Author string `json:"author" sql:"author"` AuthorID int64 `json:"author_id" sql:"author_id"` CreatedAt time.Time `json:"created_at" sql:"created_at"` AuthorTier TierType `json:"author_tier" sql:"author_tier"` Awards []int64 `json:"awards" sql:"awards"` Coffee uint64 `json:"coffee" sql:"coffee"` DiscussionId int64 `json:"discussion_id" sql:"discussion_id"` Leads bool `json:"leads" sql:"leads"` Revision int `json:"revision" sql:"revision"` DiscussionLevel CommunicationType `json:"discussion_level" sql:"discussion_level"` RewardID *int64 `json:"reward_id" sql:"reward_id"` Name *string `json:"name" sql:"name"` ColorPalette *string `json:"color_palette" sql:"color_palette"` RenderInFront *bool `json:"render_in_front" sql:"render_in_front"` UserStatus UserStatus `json:"user_status" sql:"user_status"` }
func (*CommentBackground) ToFrontend ¶
func (i *CommentBackground) ToFrontend() *CommentBackgroundFrontend
type CommentBackgroundFrontend ¶
type CommentBackgroundFrontend struct { ID string `json:"_id" sql:"_id"` Body string `json:"body" sql:"body"` Author string `json:"author" sql:"author"` AuthorID string `json:"author_id" sql:"author_id"` CreatedAt time.Time `json:"created_at" sql:"created_at"` AuthorTier TierType `json:"author_tier" sql:"author_tier"` Awards []string `json:"awards" sql:"awards"` Coffee string `json:"coffee" sql:"coffee"` DiscussionId string `json:"discussion_id" sql:"discussion_id"` Leads bool `json:"leads" sql:"leads"` Revision int `json:"revision" sql:"revision"` DiscussionLevel CommunicationType `json:"discussion_level" sql:"discussion_level"` Thumbnail string `json:"thumbnail"` RewardID *string `json:"reward_id" sql:"reward_id"` Name *string `json:"name" sql:"name"` ColorPalette *string `json:"color_palette" sql:"color_palette"` RenderInFront *bool `json:"render_in_front" sql:"render_in_front"` UserStatus UserStatus `json:"user_status" sql:"user_status"` }
type CommentBackgroundSQL ¶
type CommentBackgroundSQL struct { ID int64 `json:"_id" sql:"_id"` Body string `json:"body" sql:"body"` Author string `json:"author" sql:"author"` AuthorID int64 `json:"author_id" sql:"author_id"` CreatedAt time.Time `json:"created_at" sql:"created_at"` AuthorTier TierType `json:"author_tier" sql:"author_tier"` Coffee uint64 `json:"coffee" sql:"coffee"` DiscussionId int64 `json:"discussion_id" sql:"discussion_id"` Leads bool `json:"leads" sql:"leads"` Revision int `json:"revision" sql:"revision"` DiscussionLevel CommunicationType `json:"discussion_level" sql:"discussion_level"` RewardID *int64 `json:"reward_id" sql:"reward_id"` Name *string `json:"name" sql:"name"` ColorPalette *string `json:"color_palette" sql:"color_palette"` RenderInFront *bool `json:"render_in_front" sql:"render_in_front"` UserStatus UserStatus `json:"user_status" sql:"user_status"` }
type CommentFrontend ¶
type CommentFrontend struct { ID string `json:"_id" sql:"_id"` Body string `json:"body" sql:"body"` Author string `json:"author" sql:"author"` AuthorID string `json:"author_id" sql:"author_id"` CreatedAt time.Time `json:"created_at" sql:"created_at"` AuthorTier TierType `json:"author_tier" sql:"author_tier"` Awards []string `json:"awards" sql:"awards"` Coffee string `json:"coffee" sql:"coffee"` DiscussionId string `json:"discussion_id" sql:"discussion_id"` Leads bool `json:"leads" sql:"leads"` Revision int `json:"revision" sql:"revision"` DiscussionLevel CommunicationType `json:"discussion_level" sql:"discussion_level"` Thumbnail string `json:"thumbnail"` }
type CommentSQL ¶
type CommentSQL struct { ID int64 `json:"_id" sql:"_id"` Body string `json:"body" sql:"body"` Author string `json:"author" sql:"author"` AuthorID int64 `json:"author_id" sql:"author_id"` CreatedAt time.Time `json:"created_at" sql:"created_at"` AuthorTier TierType `json:"author_tier" sql:"author_tier"` Coffee uint64 `json:"coffee" sql:"coffee"` DiscussionId int64 `json:"discussion_id" sql:"discussion_id"` Leads bool `json:"leads" sql:"leads"` Revision int `json:"revision" sql:"revision"` DiscussionLevel CommunicationType `json:"discussion_level" sql:"discussion_level"` }
type CommunicationType ¶
type CommunicationType int
const ( DiscussionLevel CommunicationType = iota CommentLevel ThreadLevel ThreadReplyLevel )
func (CommunicationType) String ¶
func (c CommunicationType) String() string
type ContentType ¶
type ContentType int
const ( PostType ContentType = iota DiscussionType CommentType AttemptType ThreadCommentType )
func (ContentType) String ¶
func (s ContentType) String() string
type CuratedPost ¶
type CuratedPost struct { ID int64 `json:"_id" sql:"_id"` PostID int64 `json:"post_id" sql:"post_id"` ProficiencyLevels []ProficiencyType `json:"proficiency_type" sql:"proficiency_type"` PostLanguage ProgrammingLanguage `json:"post_language" sql:"post_language"` }
func CreateCuratedPost ¶
func CreateCuratedPost(id int64, postId int64, proficiencyLevels []ProficiencyType, postLanguage ProgrammingLanguage) (*CuratedPost, error)
func (*CuratedPost) ToFrontend ¶
func (i *CuratedPost) ToFrontend() *CuratedPostFrontend
func (*CuratedPost) ToSQLNative ¶
func (i *CuratedPost) ToSQLNative() []*SQLInsertStatement
type CuratedPostFrontend ¶
type CuratedPostFrontend struct { ID string `json:"_id" sql:"_id"` PostID string `json:"post_id" sql:"post_id"` ProficiencyLevels []ProficiencyType `json:"proficiency_type" sql:"proficiency_type"` PostLanguage ProgrammingLanguage `json:"post_language" sql:"post_language"` }
type CuratedPostSQL ¶
type CuratedPostSQL struct { ID int64 `json:"_id" sql:"_id"` PostID int64 `json:"post_id" sql:"post_id"` PostLanguage ProgrammingLanguage `json:"post_language" sql:"post_language"` }
type DailyUsage ¶
type Discussion ¶
type Discussion struct { ID int64 `json:"_id" sql:"_id"` Body string `json:"body" sql:"body"` Author string `json:"author" sql:"author"` AuthorID int64 `json:"author_id" sql:"author_id"` CreatedAt time.Time `json:"created_at" sql:"created_at"` UpdatedAt time.Time `json:"updated_at" sql:"updated_at"` AuthorTier TierType `json:"author_tier" sql:"author_tier"` Awards []int64 `json:"awards" sql:"awards"` Coffee uint64 `json:"coffee" sql:"coffee"` PostId int64 `json:"post_id" sql:"post_id"` Title string `json:"title" sql:"title"` Tags []int64 `json:"tags" sql:"tags"` Leads bool `json:"leads" sql:"leads"` Revision int `json:"revision" sql:"revision"` DiscussionLevel CommunicationType `json:"discussion_level" sql:"discussion_level"` }
func CreateDiscussion ¶
func DiscussionFromSQLNative ¶
func DiscussionFromSQLNative(db *ti.Database, rows *sql.Rows) (*Discussion, error)
func (*Discussion) ToFrontend ¶
func (i *Discussion) ToFrontend() *DiscussionFrontend
func (*Discussion) ToSQLNative ¶
func (i *Discussion) ToSQLNative() []*SQLInsertStatement
type DiscussionBackground ¶
type DiscussionBackground struct { ID int64 `json:"_id" sql:"_id"` Body string `json:"body" sql:"body"` Author string `json:"author" sql:"author"` AuthorID int64 `json:"author_id" sql:"author_id"` CreatedAt time.Time `json:"created_at" sql:"created_at"` UpdatedAt time.Time `json:"updated_at" sql:"updated_at"` AuthorTier TierType `json:"author_tier" sql:"author_tier"` Awards []int64 `json:"awards" sql:"awards"` Coffee uint64 `json:"coffee" sql:"coffee"` PostId int64 `json:"post_id" sql:"post_id"` Title string `json:"title" sql:"title"` Tags []int64 `json:"tags" sql:"tags"` Leads bool `json:"leads" sql:"leads"` Revision int `json:"revision" sql:"revision"` DiscussionLevel CommunicationType `json:"discussion_level" sql:"discussion_level"` RewardID *int64 `json:"reward_id" sql:"reward_id"` Name *string `json:"name" sql:"name"` ColorPalette *string `json:"color_palette" sql:"color_palette"` RenderInFront *bool `json:"render_in_front" sql:"render_in_front"` UserStatus UserStatus `json:"user_status" sql:"user_status"` }
func (*DiscussionBackground) ToFrontend ¶
func (i *DiscussionBackground) ToFrontend() *DiscussionBackgroundFrontend
type DiscussionBackgroundFrontend ¶
type DiscussionBackgroundFrontend struct { ID string `json:"_id" sql:"_id"` Body string `json:"body" sql:"body"` Author string `json:"author" sql:"author"` AuthorID string `json:"author_id" sql:"author_id"` CreatedAt time.Time `json:"created_at" sql:"created_at"` UpdatedAt time.Time `json:"updated_at" sql:"updated_at"` AuthorTier TierType `json:"author_tier" sql:"author_tier"` Awards []string `json:"awards" sql:"awards"` Coffee string `json:"coffee" sql:"coffee"` PostId string `json:"post_id" sql:"post_id"` Title string `json:"title" sql:"title"` Tags []string `json:"tags" sql:"tags"` Leads bool `json:"leads" sql:"leads"` Revision int `json:"revision" sql:"revision"` DiscussionLevel CommunicationType `json:"discussion_level" sql:"discussion_level"` Thumbnail string `json:"thumbnail"` RewardID *string `json:"reward_id" sql:"reward_id"` Name *string `json:"name" sql:"name"` ColorPalette *string `json:"color_palette" sql:"color_palette"` RenderInFront *bool `json:"render_in_front" sql:"render_in_front"` UserStatus UserStatus `json:"user_status" sql:"user_status"` }
type DiscussionBackgroundSQL ¶
type DiscussionBackgroundSQL struct { ID int64 `json:"_id" sql:"_id"` Body string `json:"body" sql:"body"` Author string `json:"author" sql:"author"` AuthorID int64 `json:"author_id" sql:"author_id"` CreatedAt time.Time `json:"created_at" sql:"created_at"` UpdatedAt time.Time `json:"updated_at" sql:"updated_at"` AuthorTier TierType `json:"author_tier" sql:"author_tier"` Coffee uint64 `json:"coffee" sql:"coffee"` PostId int64 `json:"post_id" sql:"post_id"` Title string `json:"title" sql:"title"` Revision int `json:"revision" sql:"revision"` Leads bool `json:"leads" sql:"leads"` DiscussionLevel CommunicationType `json:"discussion_level" sql:"discussion_level"` RewardID *int64 `json:"reward_id" sql:"reward_id"` Name *string `json:"name" sql:"name"` ColorPalette *string `json:"color_palette" sql:"color_palette"` RenderInFront *bool `json:"render_in_front" sql:"render_in_front"` UserStatus UserStatus `json:"user_status" sql:"user_status"` }
type DiscussionFrontend ¶
type DiscussionFrontend struct { ID string `json:"_id" sql:"_id"` Body string `json:"body" sql:"body"` Author string `json:"author" sql:"author"` AuthorID string `json:"author_id" sql:"author_id"` CreatedAt time.Time `json:"created_at" sql:"created_at"` UpdatedAt time.Time `json:"updated_at" sql:"updated_at"` AuthorTier TierType `json:"author_tier" sql:"author_tier"` Awards []string `json:"awards" sql:"awards"` Coffee string `json:"coffee" sql:"coffee"` PostId string `json:"post_id" sql:"post_id"` Title string `json:"title" sql:"title"` Tags []string `json:"tags" sql:"tags"` Leads bool `json:"leads" sql:"leads"` Revision int `json:"revision" sql:"revision"` DiscussionLevel CommunicationType `json:"discussion_level" sql:"discussion_level"` Thumbnail string `json:"thumbnail"` }
type DiscussionSQL ¶
type DiscussionSQL struct { ID int64 `json:"_id" sql:"_id"` Body string `json:"body" sql:"body"` Author string `json:"author" sql:"author"` AuthorID int64 `json:"author_id" sql:"author_id"` CreatedAt time.Time `json:"created_at" sql:"created_at"` UpdatedAt time.Time `json:"updated_at" sql:"updated_at"` AuthorTier TierType `json:"author_tier" sql:"author_tier"` Coffee uint64 `json:"coffee" sql:"coffee"` PostId int64 `json:"post_id" sql:"post_id"` Title string `json:"title" sql:"title"` Revision int `json:"revision" sql:"revision"` Leads bool `json:"leads" sql:"leads"` DiscussionLevel CommunicationType `json:"discussion_level" sql:"discussion_level"` }
type ExclusiveContentPurchases ¶
type ExclusiveContentPurchases struct { UserId int64 `json:"user_id" sql:"user_id"` Post int64 `json:"post" sql:"post"` Date time.Time `json:"date" sql:"date"` }
func CreateExclusiveContentPurchases ¶
func CreateExclusiveContentPurchases(userId int64, post int64) (*ExclusiveContentPurchases, error)
func (*ExclusiveContentPurchases) ToFrontend ¶
func (i *ExclusiveContentPurchases) ToFrontend() *ExclusiveContentPurchasesFrontend
func (*ExclusiveContentPurchases) ToSQLNative ¶
func (i *ExclusiveContentPurchases) ToSQLNative() *SQLInsertStatement
type Follower ¶
type Follower struct { Follower int64 `json:"follower" sql:"follower"` Following int64 `json:"following" sql:"following"` }
func FollowerFromSQLNative ¶
func (*Follower) ToFrontend ¶
func (i *Follower) ToFrontend() *FollowerFrontend
func (*Follower) ToSQLNative ¶
func (i *Follower) ToSQLNative() *SQLInsertStatement
type FollowerFrontend ¶
type FollowerSQL ¶
type FriendRequests ¶
type FriendRequests struct { ID int64 `json:"_id"` UserID int64 `json:"user_id" sql:"user_id"` UserName string `json:"user_name" sql:"user_name"` Friend int64 `json:"friend" sql:"friend"` FriendName string `json:"friend_name" sql:"friend_name"` Response *bool `json:"response" sql:"response"` Date time.Time `json:"date" sql:"date"` NotificationID int64 `json:"notification_id" sql:"notification_id"` }
func CreateFriendRequests ¶
func (*FriendRequests) ToFrontend ¶
func (i *FriendRequests) ToFrontend() *FriendRequestsFrontend
func (*FriendRequests) ToSQLNative ¶
func (i *FriendRequests) ToSQLNative() *SQLInsertStatement
type FriendRequestsFrontend ¶
type FriendRequestsFrontend struct { ID string `json:"_id"` UserID string `json:"user_id" sql:"user_id"` UserName string `json:"user_name" sql:"user_name"` Friend string `json:"friend" sql:"friend"` FriendName string `json:"friend_name" sql:"friend_name"` Response *bool `json:"response" sql:"response"` Date time.Time `json:"date" sql:"date"` NotificationID string `json:"notification_id" sql:"notification_id"` }
type FriendRequestsSQL ¶
type FriendRequestsSQL struct { ID int64 `json:"_id"` UserID int64 `json:"user_id" sql:"user_id"` UserName string `json:"user_name" sql:"user_name"` Friend int64 `json:"friend" sql:"friend"` FriendName string `json:"friend_name" sql:"friend_name"` Response *bool `json:"response" sql:"response"` Date time.Time `json:"date" sql:"date"` NotificationID int64 `json:"notification_id" sql:"notification_id"` }
type Friends ¶
type Friends struct { ID int64 `json:"_id"` UserID int64 `json:"user_id" sql:"user_id"` UserName string `json:"user_name" sql:"user_name"` Friend int64 `json:"friend" sql:"friend"` FriendName string `json:"friend_name" sql:"friend_name"` Date time.Time `json:"date" sql:"date"` }
func CreateFriends ¶
func FriendsFromSQLNative ¶
func (*Friends) ToFrontend ¶
func (i *Friends) ToFrontend() *FriendsFrontend
func (*Friends) ToSQLNative ¶
func (i *Friends) ToSQLNative() *SQLInsertStatement
type FriendsFrontend ¶
type FriendsSQL ¶
type ImplicitAction ¶
type ImplicitAction int
func (ImplicitAction) String ¶
func (r ImplicitAction) String() string
type ImplicitRec ¶
type ImplicitRec struct { ID int64 `sql:"_id"` UserID int64 `sql:"user_id"` PostID int64 `sql:"post_id"` SessionID uuid.UUID `sql:"session_id"` ImplicitAction ImplicitAction `sql:"implicit_action"` CreatedAt time.Time `sql:"created_at"` UserTierAtAction TierType `json:"user_tier_at_action" sql:"user_tier_at_action"` }
func CreateImplicitRec ¶
func CreateImplicitRec(id int64, userId int64, postId int64, sessionId uuid.UUID, action ImplicitAction, createdAt time.Time, userTierAtAction TierType) *ImplicitRec
func ImplicitRecFromSQLNative ¶
func ImplicitRecFromSQLNative(rows *sql.Rows) (*ImplicitRec, error)
func (*ImplicitRec) ToFrontend ¶
func (i *ImplicitRec) ToFrontend() *ImplicitRecFrontend
func (*ImplicitRec) ToSQLNative ¶
func (i *ImplicitRec) ToSQLNative() *SQLInsertStatement
type ImplicitRecFrontend ¶
type ImplicitRecFrontend struct { ID string `sql:"_id"` UserID string `sql:"user_id"` PostID string `sql:"post_id"` SessionID string `sql:"session_id"` ImplicitAction ImplicitAction `sql:"implicit_action"` CreatedAt time.Time `sql:"created_at"` UserTierAtAction TierType `json:"user_tier_at_action" sql:"user_tier_at_action"` }
type ImplicitRecSQL ¶
type ImplicitRecSQL struct { ID int64 `sql:"_id"` UserID int64 `sql:"user_id"` PostID int64 `sql:"post_id"` SessionID uuid.UUID `sql:"session_id"` ImplicitAction ImplicitAction `sql:"implicit_action"` CreatedAt time.Time `sql:"created_at"` UserTierAtAction TierType `json:"user_tier_at_action" sql:"user_tier_at_action"` }
type Nemesis ¶
type Nemesis struct { ID int64 `json:"id" sql:"_id"` AntagonistID int64 `json:"antagonist_id" sql:"antagonist_id"` AntagonistName string `json:"antagonist_name" sql:"antagonist_name"` AntagonistTowersCaptured uint64 `json:"antagonist_towers_captured" sql:"antagonist_towers_captured"` ProtagonistID int64 `json:"protagonist_id" sql:"protagonist_id"` ProtagonistName string `json:"protagonist_name" sql:"protagonist_name"` ProtagonistTowersCaptured uint64 `json:"protagonist_towers_captured" sql:"protagonist_towers_captured"` TimeOfVillainy time.Time `json:"time_of_villainy" sql:"time_of_villainy"` Victor *int64 `json:"victor" sql:"victor"` IsAccepted bool `json:"is_accepted" sql:"is_accepted"` EndTime *time.Time `json:"end_time" sql:"end_time"` }
func CreateNemesis ¶
func (*Nemesis) ToFrontend ¶
func (i *Nemesis) ToFrontend() *NemesisFrontend
func (*Nemesis) ToSQLNative ¶
func (i *Nemesis) ToSQLNative() []*SQLInsertStatement
type NemesisFrontend ¶
type NemesisFrontend struct { ID string `json:"id" sql:"_id"` AntagonistID string `json:"antagonist_id" sql:"antagonist_id"` AntagonistName string `json:"antagonist_name" sql:"antagonist_name"` AntagonistTowersCaptured string `json:"antagonist_towers_captured" sql:"antagonist_towers_captured"` ProtagonistID string `json:"protagonist_id" sql:"protagonist_id"` ProtagonistName string `json:"protagonist_name" sql:"protagonist_name"` ProtagonistTowersCaptured string `json:"protagonist_towers_captured" sql:"protagonist_towers_captured"` TimeOfVillainy time.Time `json:"time_of_villainy" sql:"time_of_villainy"` Victor *string `json:"victor" sql:"victor"` IsAccepted bool `json:"is_accepted" sql:"is_accepted"` EndTime *time.Time `json:"end_time" sql:"end_time"` }
type NemesisHistory ¶
type NemesisHistory struct { ID int64 `json:"id" sql:"_id"` MatchID int64 `json:"match_id" sql:"match_id"` AntagonistID int64 `json:"antagonist_id" sql:"antagonist_id"` ProtagonistID int64 `json:"protagonist_id" sql:"protagonist_id"` ProtagonistTowersHeld int64 `json:"protagonist_towers_held" sql:"protagonist_towers_held"` AntagonistTowersHeld int64 `json:"antagonist_towers_held" sql:"antagonist_towers_held"` ProtagonistTotalXP int64 `json:"protagonist_total_xp" sql:"protagonist_total_xp"` AntagonistTotalXP int64 `json:"antagonist_total_xp" sql:"antagonist_total_xp"` IsAlerted bool `json:"is_alerted" sql:"is_alerted"` CreatedAt time.Time `json:"created_at" sql:"created_at"` }
func (*NemesisHistory) ToSQLNative ¶
func (i *NemesisHistory) ToSQLNative() []*SQLInsertStatement
type NemesisSQL ¶
type NemesisSQL struct { ID int64 `json:"id" sql:"_id"` AntagonistID int64 `json:"antagonist_id" sql:"antagonist_id"` AntagonistName string `json:"antagonist_name" sql:"antagonist_name"` AntagonistTowersCaptured uint64 `json:"antagonist_towers_captured" sql:"antagonist_towers_captured"` ProtagonistID int64 `json:"protagonist_id" sql:"protagonist_id"` ProtagonistName string `json:"protagonist_name" sql:"protagonist_name"` ProtagonistTowersCaptured uint64 `json:"protagonist_towers_captured" sql:"protagonist_towers_captured"` TimeOfVillainy time.Time `json:"time_of_villainy" sql:"time_of_villainy"` Victor *int64 `json:"victor" sql:"victor"` IsAccepted bool `json:"is_accepted" sql:"is_accepted"` EndTime *time.Time `json:"end_time" sql:"end_time"` }
type Notification ¶
type Notification struct { ID int64 `json:"_id" sql:"_id"` UserID int64 `json:"user_id" sql:"user_id"` Message string `json:"message" sql:"message"` NotificationType NotificationType `json:"notification_type" sql:"notification_type"` CreatedAt time.Time `json:"created_at" sql:"created_at"` Acknowledged bool `json:"acknowledged" sql:"acknowledged"` InteractingUserID *int64 `json:"interacting_user_id" sql:"interacting_user_id"` }
func CreateNotification ¶
func CreateNotification(id int64, userID int64, message string, notificationType NotificationType, createdAt time.Time, acknowledged bool, interactingUser *int64) (*Notification, error)
func NotificationFromSQLNative ¶
func NotificationFromSQLNative(rows *sql.Rows) (*Notification, error)
func (*Notification) ToFrontend ¶
func (i *Notification) ToFrontend() *NotificationFrontend
func (*Notification) ToSQLNative ¶
func (i *Notification) ToSQLNative() *SQLInsertStatement
type NotificationFrontend ¶
type NotificationFrontend struct { ID string `json:"_id" sql:"_id"` UserID string `json:"user_id" sql:"user_id"` Message string `json:"message" sql:"message"` NotificationType NotificationType `json:"notification_type" sql:"notification_type"` CreatedAt time.Time `json:"created_at" sql:"created_at"` Acknowledged bool `json:"acknowledged" sql:"acknowledged"` InteractingUserID *string `json:"interacting_user_id" sql:"interacting_user_id"` }
type NotificationSQL ¶
type NotificationSQL struct { ID int64 `json:"_id" sql:"_id"` UserID int64 `json:"user_id" sql:"user_id"` Message string `json:"message" sql:"message"` NotificationType NotificationType `json:"notification_type" sql:"notification_type"` CreatedAt time.Time `json:"created_at" sql:"created_at"` Acknowledged bool `json:"acknowledged" sql:"acknowledged"` InteractingUserID *int64 `json:"interacting_user_id" sql:"interacting_user_id"` }
type NotificationType ¶
type NotificationType int
const ( FriendRequest NotificationType = iota NemesisRequest NemesisAlert StreakInfo )
func (NotificationType) String ¶
func (b NotificationType) String() string
type OverAllocated ¶
type Post ¶
type Post struct { ID int64 `json:"_id" sql:"_id"` Title string `json:"title" sql:"title"` Description string `json:"description" sql:"description"` Author string `json:"author" sql:"author"` AuthorID int64 `json:"author_id" sql:"author_id"` CreatedAt time.Time `json:"created_at" sql:"created_at"` UpdatedAt time.Time `json:"updated_at" sql:"updated_at"` RepoID int64 `json:"repo_id" sql:"repo_id"` Tier TierType `json:"tier" sql:"tier"` Awards []int64 `json:"awards" sql:"awards"` TopReply *int64 `json:"top_reply,omitempty" sql:"top_reply"` Coffee uint64 `json:"coffee" sql:"coffee"` Tags []int64 `json:"tags" sql:"tags"` PostType ChallengeType `json:"post_type" sql:"post_type"` Views int64 `json:"views" sql:"views"` Completions int64 `json:"completions" sql:"completions"` Attempts int64 `json:"attempts" sql:"attempts"` Languages []ProgrammingLanguage `json:"languages" sql:"languages"` Published bool `json:"published" sql:"published"` Visibility PostVisibility `json:"visibility" sql:"visibility"` StripePriceId *string `json:"stripe_price_id" sql:"stripe_price_id"` ChallengeCost *string `json:"challenge_cost" sql:"challenge_cost"` WorkspaceConfig int64 `json:"workspace_config" sql:"workspace_config"` WorkspaceConfigRevision int `json:"workspace_config_revision" sql:"workspace_config_revision"` WorkspaceSettings *WorkspaceSettings `json:"workspace_settings" sql:"workspace_settings"` Leads bool `json:"leads" sql:"leads"` Embedded bool `json:"embedded" sql:"embedded"` Deleted bool `json:"deleted" sql:"deleted"` ExclusiveDescription *string `json:"exclusive_description,omitempty" sql:"exclusive_description"` }
func CreatePost ¶
func CreatePost(id int64, title string, description string, author string, authorID int64, createdAt time.Time, updatedAt time.Time, repoId int64, tier TierType, awards []int64, topReply *int64, coffee uint64, postType ChallengeType, views int64, completions int64, attempts int64, language []ProgrammingLanguage, visibility PostVisibility, tags []int64, challengeCost *string, stripeId *string, workspaceCfg int64, workspaceCfgRevision int, workspaceSettings *WorkspaceSettings, leads bool, embedded bool, exclusiveDescription *string) (*Post, error)
func (*Post) ToFrontend ¶
func (i *Post) ToFrontend() (*PostFrontend, error)
func (*Post) ToSQLNative ¶
func (i *Post) ToSQLNative() ([]*SQLInsertStatement, error)
type PostFrontend ¶
type PostFrontend struct { ID string `json:"_id"` Title string `json:"title"` Description string `json:"description"` Author string `json:"author"` AuthorID string `json:"author_id"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` RepoID string `json:"repo_id"` Tier TierType `json:"tier"` TierString string `json:"tier_string"` Awards []string `json:"awards"` TopReply *string `json:"top_reply"` Coffee uint64 `json:"coffee"` PostType ChallengeType `json:"post_type"` PostTypeString string `json:"post_type_string"` Views int64 `json:"views"` Completions int64 `json:"completions"` Attempts int64 `json:"attempts"` Languages []ProgrammingLanguage `json:"languages"` LanguageStrings []string `json:"languages_strings"` Published bool `json:"published"` Visibility PostVisibility `json:"visibility"` VisibilityString string `json:"visibility_string"` Tags []string `json:"tags"` Thumbnail string `json:"thumbnail"` ChallengeCost *string `json:"challenge_cost"` WorkspaceConfig string `json:"workspace_config"` WorkspaceConfigRevision int `json:"workspace_config_revision"` Leads bool `json:"leads" sql:"leads"` Deleted bool `json:"deleted" sql:"deleted"` ExclusiveDescription *string `json:"exclusive_description"` }
type PostSQL ¶
type PostSQL struct { ID int64 `json:"_id" sql:"_id"` Title string `json:"title" sql:"title"` Description string `json:"description" sql:"description"` Author string `json:"author" sql:"author"` AuthorID int64 `json:"author_id" sql:"author_id"` CreatedAt time.Time `json:"created_at" sql:"created_at"` UpdatedAt time.Time `json:"updated_at" sql:"updated_at"` RepoID int64 `json:"repo_id" sql:"repo_id"` Tier TierType `json:"tier" sql:"tier"` TopReply *int64 `json:"top_reply,omitempty" sql:"top_reply"` Coffee uint64 `json:"coffee" sql:"coffee"` PostType ChallengeType `json:"post_type" sql:"post_type"` Views int64 `json:"views" sql:"views"` Completions int64 `json:"completions" sql:"completions"` Attempts int64 `json:"attempts" sql:"attempts"` Published bool `json:"published" sql:"published"` Visibility PostVisibility `json:"visibility" sql:"visibility"` StripePriceId *string `json:"stripe_price_id" sql:"stripe_price_id"` ChallengeCost *string `json:"challenge_cost" sql:"challenge_cost"` WorkspaceConfig int64 `json:"workspace_config" sql:"workspace_config"` WorkspaceConfigRevision int `json:"workspace_config_revision" sql:"workspace_config_revision"` WorkspaceSettings []byte `json:"workspace_settings" sql:"workspace_settings"` Leads bool `json:"leads" sql:"leads"` Embedded bool `json:"embedded" sql:"embedded"` Deleted bool `json:"deleted" sql:"deleted"` ExclusiveDescription *string `json:"exclusive_description" sql:"exclusive_description"` }
type PostVisibility ¶
type PostVisibility int
const ( PublicVisibility PostVisibility = iota PrivateVisibility FriendsVisibility FollowerVisibility PremiumVisibility ExclusiveVisibility )
func (PostVisibility) String ¶
func (w PostVisibility) String() string
type ProficiencyType ¶
type ProficiencyType int
func (ProficiencyType) String ¶
func (p ProficiencyType) String() string
type ProgrammingLanguage ¶
type ProgrammingLanguage int
const ( AnyProgrammingLanguage ProgrammingLanguage = iota CustomProgrammingLanguage Java JavaScript TypeScript Python Go Ruby Cpp C Csharp ObjectiveC Swift PHP Rust Kotlin Dart Scala CoffeeScript Haskell Lua Clojure Perl Shell Elixir Assembly Groovy Html Julia OCaml R Ada Erlang Matlab SQL Cobol Lisp HCL )
func (ProgrammingLanguage) String ¶
func (l ProgrammingLanguage) String() string
type RecommendationType ¶
type RecommendationType int
func (RecommendationType) String ¶
func (r RecommendationType) String() string
type RecommendedPost ¶
type RecommendedPost struct { ID int64 `json:"_id" sql:"_id"` UserID int64 `json:"user_id" sql:"user_id"` PostID int64 `json:"post_id" sql:"post_id"` Type RecommendationType `json:"type" sql:"type"` ReferenceID int64 `json:"reference_id" sql:"reference_id"` Score float32 `json:"score" sql:"score"` CreatedAt time.Time `json:"created_at" sql:"created_at"` ExpiresAt time.Time `json:"expires_at" sql:"expires_at"` ReferenceTier TierType `json:"reference_tier" sql:"reference_tier"` Accepted bool `json:"accepted" sql:"accepted"` Views int64 `json:"views" sql:"views"` }
func CreateRecommendedPost ¶
func RecommendedPostFromSQLNative ¶
func RecommendedPostFromSQLNative(rows *sql.Rows) (*RecommendedPost, error)
func (*RecommendedPost) ToFrontend ¶
func (i *RecommendedPost) ToFrontend() *RecommendedPostFrontend
func (*RecommendedPost) ToSQLNative ¶
func (i *RecommendedPost) ToSQLNative() *SQLInsertStatement
type RecommendedPostFrontend ¶
type RecommendedPostFrontend struct { ID string `json:"_id"` UserID string `json:"user_id"` PostID string `json:"post_id"` Type RecommendationType `json:"type"` TypeString string `json:"type_string"` ReferenceID string `json:"reference_id"` Score float32 `json:"score"` CreatedAt time.Time `json:"created_at"` ExpiresAt time.Time `json:"expires_at"` ReferenceTier TierType `json:"reference_tier" sql:"reference_tier"` }
type RecommendedPostSQL ¶
type RecommendedPostSQL struct { ID int64 `sql:"_id"` UserID int64 `sql:"user_id"` PostID int64 `sql:"post_id"` Type RecommendationType `sql:"type"` ReferenceID int64 `sql:"reference_id"` Score float32 `sql:"score"` CreatedAt time.Time `sql:"created_at"` ExpiresAt time.Time `sql:"expires_at"` ReferenceTier TierType `json:"reference_tier" sql:"reference_tier"` Accepted bool `json:"accepted" sql:"accepted"` Views int64 `json:"views" sql:"views"` }
type Renown10Struct ¶
type Renown10Struct struct { Level1 uint64 Level2 uint64 Level3 uint64 Level4 uint64 Level5 uint64 Level6 uint64 Level7 uint64 Level8 uint64 Level9 uint64 Level10 uint64 }
func GetRenown10 ¶
func GetRenown10() *Renown10Struct
type Renown1Struct ¶
type Renown1Struct struct { Level1 uint64 Level2 uint64 Level3 uint64 Level4 uint64 Level5 uint64 Level6 uint64 Level7 uint64 Level8 uint64 Level9 uint64 Level10 uint64 }
func GetRenown1 ¶
func GetRenown1() *Renown1Struct
type Renown2Struct ¶
type Renown2Struct struct { Level1 uint64 Level2 uint64 Level3 uint64 Level4 uint64 Level5 uint64 Level6 uint64 Level7 uint64 Level8 uint64 Level9 uint64 Level10 uint64 }
func GetRenown2 ¶
func GetRenown2() *Renown2Struct
type Renown3Struct ¶
type Renown3Struct struct { Level1 uint64 Level2 uint64 Level3 uint64 Level4 uint64 Level5 uint64 Level6 uint64 Level7 uint64 Level8 uint64 Level9 uint64 Level10 uint64 }
func GetRenown3 ¶
func GetRenown3() *Renown3Struct
type Renown4Struct ¶
type Renown4Struct struct { Level1 uint64 Level2 uint64 Level3 uint64 Level4 uint64 Level5 uint64 Level6 uint64 Level7 uint64 Level8 uint64 Level9 uint64 Level10 uint64 }
func GetRenown4 ¶
func GetRenown4() *Renown4Struct
type Renown5Struct ¶
type Renown5Struct struct { Level1 uint64 Level2 uint64 Level3 uint64 Level4 uint64 Level5 uint64 Level6 uint64 Level7 uint64 Level8 uint64 Level9 uint64 Level10 uint64 }
func GetRenown5 ¶
func GetRenown5() *Renown5Struct
type Renown6Struct ¶
type Renown6Struct struct { Level1 uint64 Level2 uint64 Level3 uint64 Level4 uint64 Level5 uint64 Level6 uint64 Level7 uint64 Level8 uint64 Level9 uint64 Level10 uint64 }
func GetRenown6 ¶
func GetRenown6() *Renown6Struct
type Renown7Struct ¶
type Renown7Struct struct { Level1 uint64 Level2 uint64 Level3 uint64 Level4 uint64 Level5 uint64 Level6 uint64 Level7 uint64 Level8 uint64 Level9 uint64 Level10 uint64 }
func GetRenown7 ¶
func GetRenown7() *Renown7Struct
type Renown8Struct ¶
type Renown8Struct struct { Level1 uint64 Level2 uint64 Level3 uint64 Level4 uint64 Level5 uint64 Level6 uint64 Level7 uint64 Level8 uint64 Level9 uint64 Level10 uint64 }
func GetRenown8 ¶
func GetRenown8() *Renown8Struct
type Renown9Struct ¶
type Renown9Struct struct { Level1 uint64 Level2 uint64 Level3 uint64 Level4 uint64 Level5 uint64 Level6 uint64 Level7 uint64 Level8 uint64 Level9 uint64 Level10 uint64 }
func GetRenown9 ¶
func GetRenown9() *Renown9Struct
type ReportIssue ¶
type ReportIssue struct { Date time.Time `json:"date" sql:"date"` UserId int64 `json:"user_id" sql:"user_id"` Page string `json:"page" sql:"page"` Issue string `json:"issue" sql:"issue"` Id int64 `json:"id" sql:"id"` }
func CreateReportIssue ¶
func (*ReportIssue) ToFrontend ¶
func (i *ReportIssue) ToFrontend() *ReportIssueFrontend
func (*ReportIssue) ToSQLNative ¶
func (i *ReportIssue) ToSQLNative() *SQLInsertStatement
type ReportIssueFrontend ¶
type ReportIssueSQL ¶
type Rewards ¶
type Rewards struct { ID int64 `json:"id" sql:"_id"` Name string `json:"name" sql:"name"` ColorPalette string `json:"color_palette" sql:"color_palette"` RenderInFront bool `json:"render_in_front" sql:"render_in_front"` }
func CreateRewards ¶
func (*Rewards) ToFrontend ¶
func (i *Rewards) ToFrontend() *RewardsFrontend
type RewardsFrontend ¶
type RewardsSQL ¶
type SQLInsertStatement ¶
type SQLInsertStatement struct { Statement string Values []interface{} }
SQLInsertStatement Struct to hold the insert statement string and insert values for the insertion of a Go struct into the corresponding SQL schema
type SearchRec ¶
type SearchRec struct { ID int64 `sql:"_id" json:"_id"` UserID int64 `sql:"user_id" json:"user_id"` Query string `sql:"query" json:"query"` PostIDs []int64 `sql:"post_ids" json:"post_ids"` SelectedPostID *int64 `sql:"selected_post_id" json:"selected_post_id"` SelectedPostName *string `sql:"selected_post_name" json:"selected_post_name"` CreatedAt time.Time `sql:"created_at" json:"created_at"` }
func CreateSearchRec ¶
func SearchRecFromSQLNative ¶
func (*SearchRec) ToFrontend ¶
func (i *SearchRec) ToFrontend() *SearchRecFrontend
func (*SearchRec) ToSQLNative ¶
func (i *SearchRec) ToSQLNative() []*SQLInsertStatement
type SearchRecFrontend ¶
type SearchRecFrontend struct { ID string `sql:"_id" json:"_id"` UserID string `sql:"user_id" json:"user_id"` Query string `sql:"query" json:"query"` PostIDs []string `sql:"post_ids" json:"post_ids"` SelectedPostID *string `sql:"selected_post_id" json:"selected_post_id"` SelectedPostName *string `sql:"selected_post_name" json:"selected_post_name"` CreatedAt time.Time `sql:"created_at" json:"created_at"` }
type SearchRecSQL ¶
type SearchRecSQL struct { ID int64 `sql:"_id" json:"_id" json:"_id"` UserID int64 `sql:"user_id" json:"user_id"` Query string `sql:"query" json:"query"` SelectedPostID *int64 `sql:"selected_post_id" json:"selected_post_id"` SelectedPostName *string `sql:"selected_post_name" json:"selected_post_name"` CreatedAt time.Time `sql:"created_at" json:"created_at"` }
type StatsXP ¶
type StatsXP struct { StatsID int64 `json:"stats_id" sql:"stats_id"` Expiration time.Time `json:"expiration" sql:"expiration"` }
func (*StatsXP) ToSQLNative ¶
func (i *StatsXP) ToSQLNative() []*SQLInsertStatement
type Tag ¶
type Tag struct { ID int64 `json:"_id" sql:"_id"` Value string `json:"value" sql:"value"` Official bool `json:"official" sql:"official"` UsageCount int64 `json:"usage_count" sql:"usage_count"` }
func (*Tag) ToFrontend ¶
func (t *Tag) ToFrontend() *TagFrontend
func (*Tag) ToSQLNative ¶
func (t *Tag) ToSQLNative() []*SQLInsertStatement
type TagFrontend ¶
type ThreadComment ¶
type ThreadComment struct { ID int64 `json:"_id" sql:"_id"` Body string `json:"body" sql:"body"` Author string `json:"author" sql:"author"` AuthorID int64 `json:"author_id" sql:"author_id"` CreatedAt time.Time `json:"created_at" sql:"created_at"` AuthorTier TierType `json:"author_tier" sql:"author_tier"` Coffee uint64 `json:"coffee" sql:"coffee"` CommentId int64 `json:"comment_id" sql:"comment_id"` Leads bool `json:"leads" sql:"leads"` Revision int `json:"revision" sql:"revision"` DiscussionLevel CommunicationType `json:"discussion_level" sql:"discussion_level"` }
func CreateThreadComment ¶
func ThreadCommentFromSQLNative ¶
func ThreadCommentFromSQLNative(rows *sql.Rows) (*ThreadComment, error)
func (*ThreadComment) ToFrontend ¶
func (i *ThreadComment) ToFrontend() *ThreadCommentFrontend
func (*ThreadComment) ToSQLNative ¶
func (i *ThreadComment) ToSQLNative() []*SQLInsertStatement
type ThreadCommentFrontend ¶
type ThreadCommentFrontend struct { ID string `json:"_id" sql:"_id"` Body string `json:"body" sql:"body"` Author string `json:"author" sql:"author"` AuthorID string `json:"author_id" sql:"author_id"` CreatedAt time.Time `json:"created_at" sql:"created_at"` AuthorTier TierType `json:"author_tier" sql:"author_tier"` Coffee string `json:"coffee" sql:"coffee"` CommentId string `json:"comment_id" sql:"comment_id"` Leads bool `json:"leads" sql:"leads"` Revision int `json:"revision" sql:"revision"` DiscussionLevel CommunicationType `json:"discussion_level" sql:"discussion_level"` Thumbnail string `json:"thumbnail"` }
type ThreadCommentSQL ¶
type ThreadCommentSQL struct { ID int64 `json:"_id" sql:"_id"` Body string `json:"body" sql:"body"` Author string `json:"author" sql:"author"` AuthorID int64 `json:"author_id" sql:"author_id"` CreatedAt time.Time `json:"created_at" sql:"created_at"` AuthorTier TierType `json:"author_tier" sql:"author_tier"` Coffee uint64 `json:"coffee" sql:"coffee"` CommentId int64 `json:"comment_id" sql:"comment_id"` Leads bool `json:"leads" sql:"leads"` Revision int `json:"revision" sql:"revision"` DiscussionLevel CommunicationType `json:"discussion_level" sql:"discussion_level"` }
type ThreadReply ¶
type ThreadReply struct { ID int64 `json:"_id" sql:"_id"` Body string `json:"body" sql:"body"` Author string `json:"author" sql:"author"` AuthorID int64 `json:"author_id" sql:"author_id"` CreatedAt time.Time `json:"created_at" sql:"created_at"` AuthorTier TierType `json:"author_tier" sql:"author_tier"` Coffee uint64 `json:"coffee" sql:"coffee"` ThreadCommentId int64 `json:"thread_comment_id" sql:"thread_comment_id"` Revision int `json:"revision" sql:"revision"` DiscussionLevel CommunicationType `json:"discussion_level" sql:"discussion_level"` }
func CreateThreadReply ¶
func ThreadReplyFromSQLNative ¶
func ThreadReplyFromSQLNative(rows *sql.Rows) (*ThreadReply, error)
func (*ThreadReply) ToFrontend ¶
func (i *ThreadReply) ToFrontend() *ThreadReplyFrontend
func (*ThreadReply) ToSQLNative ¶
func (i *ThreadReply) ToSQLNative() []*SQLInsertStatement
type ThreadReplyFrontend ¶
type ThreadReplyFrontend struct { ID string `json:"_id" sql:"_id"` Body string `json:"body" sql:"body"` Author string `json:"author" sql:"author"` AuthorID string `json:"author_id" sql:"author_id"` CreatedAt time.Time `json:"created_at" sql:"created_at"` AuthorTier TierType `json:"author_tier" sql:"author_tier"` Coffee string `json:"coffee" sql:"coffee"` ThreadCommentId string `json:"thread_comment_id" sql:"thread_comment_id"` Revision int `json:"revision" sql:"revision"` DiscussionLevel CommunicationType `json:"discussion_level" sql:"discussion_level"` Thumbnail string `json:"thumbnail"` }
type ThreadReplySQL ¶
type ThreadReplySQL struct { ID int64 `json:"_id" sql:"_id"` Body string `json:"body" sql:"body"` Author string `json:"author" sql:"author"` AuthorID int64 `json:"author_id" sql:"author_id"` CreatedAt time.Time `json:"created_at" sql:"created_at"` AuthorTier TierType `json:"author_tier" sql:"author_tier"` Coffee uint64 `json:"coffee" sql:"coffee"` ThreadCommentId int64 `json:"thread_comment_id" sql:"thread_comment_id"` Revision int `json:"revision" sql:"revision"` DiscussionLevel CommunicationType `json:"discussion_level" sql:"discussion_level"` }
type UpVote ¶
type UpVote struct { ID int64 `json:"_id" sql:"_id"` DiscussionType CommunicationType `json:"discussion_type" sql:"discussion_type"` DiscussionId int64 `json:"discussion_id" sql:"discussion_id"` UserId int64 `json:"user_id" sql:"user_id"` }
func CreateUpVote ¶
func CreateUpVote(id int64, discussionType CommunicationType, discussionId int64, userId int64) *UpVote
func (*UpVote) ToFrontend ¶
func (u *UpVote) ToFrontend() *UpVoteFrontend
func (*UpVote) ToSQLNative ¶
func (u *UpVote) ToSQLNative() []*SQLInsertStatement
type UpVoteFrontend ¶
type UpVoteFrontend struct { ID string `json:"_id" sql:"_id"` DiscussionType CommunicationType `json:"discussion_type" sql:"discussion_type"` DiscussionId string `json:"discussion_id" sql:"discussion_id"` UserId string `json:"user_id" sql:"user_id"` }
type UpVoteSQL ¶
type UpVoteSQL struct { ID int64 `json:"_id" sql:"_id"` DiscussionType CommunicationType `json:"discussion_type" sql:"discussion_type"` DiscussionId int64 `json:"discussion_id" sql:"discussion_id"` UserId int64 `json:"user_id" sql:"user_id"` }
type User ¶
type User struct { ID int64 `json:"_id" sql:"_id"` UserName string `json:"user_name" sql:"user_name"` Password string `json:"password"` Email string `json:"email" sql:"email"` Phone string `json:"phone" sql:"phone"` UserStatus UserStatus `json:"user_status" sql:"user_status"` Bio string `json:"bio" sql:"bio"` Badges []int64 `json:"badges" sql:"badges"` XP uint64 `json:"xp" sql:"xp"` Level LevelType `json:"level" sql:"level"` Tier TierType `json:"tier" sql:"tier"` Rank RankType `json:"user_rank" sql:"user_rank"` Coffee uint64 `json:"coffee" sql:"coffee"` SavedPosts []int64 `json:"saved_posts,omitempty" sql:"saved_posts"` FirstName string `json:"first_name" sql:"first_name"` LastName string `json:"last_name" sql:"last_name"` CreatedAt time.Time `json:"created_at" sql:"created_at"` WorkspaceSettings *WorkspaceSettings `json:"workspace_settings" sql:"workspace_settings"` EncryptedServiceKey string `json:"encrypted_service_key" sql:"encrypted_service_key"` StartUserInfo *UserStart `json:"start_user_info" sql:"start_user_info"` HighestScore uint64 `json:"highest_score" sql:"highest_score"` Timezone string `json:"timezone" sql:"timezone"` AvatarSettings *AvatarSettings `json:"avatar_settings" sql:"avatar_settings"` BroadcastThreshold uint64 `json:"broadcast_threshold" sql:"broadcast_threshold"` AvatarReward *int64 `json:"avatar_reward" sql:"avatar_reward"` ExclusiveAgreement bool `json:"exclusive_agreement" sql:"exclusive_agreement"` ResetToken *string `json:"reset_token" sql:"reset_token"` HasBroadcast bool `json:"has_broadcast" sql:"has_broadcast"` HolidayThemes bool `json:"holiday_themes" sql:"holiday_themes"` Tutorials *UserTutorial `json:"tutorials" sql:"tutorials"` // Gitea GiteaID int64 `json:"gitea_id" sql:"gitea_id"` IsEphemeral bool `json:"is_ephemeral" sql:"is_ephemeral"` // Auth Otp *string `json:"otp,omitempty" sql:"otp"` OtpValidated *bool `json:"otp_validated,omitempty" sql:"otp_validated"` AuthRole AuthenticationRole `json:"auth_role" sql:"auth_role"` ExternalAuth string `json:"external_auth" sql:"external_auth"` // Stripe StripeUser *string `json:"stripe_user,omitempty" sql:"stripe_user,omitempty"` StripeAccount *string `json:"stripe_account,omitempty" sql:"stripe_account,omitempty"` StripeSubscription *string `json:"stripe_subscription" sql:"stripe_subscription"` FollowerCount uint64 `json:"follower_count" sql:"follower_count"` }
func CreateUser ¶
func CreateUser(id int64, userName string, password string, email string, phone string, userStatus UserStatus, bio string, badges []int64, savedPosts []int64, firstName string, lasName string, giteaID int64, externalAuth string, starInfo UserStart, timezone string, avatar AvatarSettings, broadcastThreshold uint64) (*User, error)
func (*User) EditUser ¶
func (i *User) EditUser(userName *string, password *string, email *string, phone *string, userStatus *UserStatus, bio *string, badges []int64, savedPosts []int64, firstName *string, lasName *string, giteaID *int64, externalAuth *string, starInfo *UserStart, timezone *string, avatar *AvatarSettings, broadcastThreshold *uint64) (*User, *SQLInsertStatement, error)
func (*User) GenerateUserOtpUri ¶
func (*User) ToFrontend ¶
func (i *User) ToFrontend() (*UserFrontend, error)
func (*User) ToSQLNative ¶
func (i *User) ToSQLNative() ([]*SQLInsertStatement, error)
func (*User) ToSearch ¶
func (i *User) ToSearch() *UserSearch
type UserFreePremium ¶
type UserFreePremium struct { Id int64 `json:"id" sql:"id"` UserId int64 `json:"user_id" sql:"user_id"` StartDate time.Time `json:"start_date" sql:"start_date"` EndDate time.Time `json:"end_date" sql:"end_date"` Length string `json:"length" sql:"length"` }
func CreateUserFreePremium ¶
func UserFreePremiumFromSQLNative ¶
func UserFreePremiumFromSQLNative(rows *sql.Rows) (*UserFreePremium, error)
func (*UserFreePremium) ToSQLNative ¶
func (i *UserFreePremium) ToSQLNative() []*SQLInsertStatement
type UserFreePremiumSQL ¶
type UserFrontend ¶
type UserFrontend struct { ID string `json:"_id" sql:"_id"` PFPPath string `json:"pfp_path" sql:"pfp_path"` UserName string `json:"user_name" sql:"user_name"` Email string `json:"email" sql:"email"` Phone string `json:"phone" sql:"phone"` UserStatus UserStatus `json:"user_status" sql:"user_status"` UserStatusString string `json:"user_status_string" sql:"user_status_string"` Bio string `json:"bio" sql:"bio"` XP uint64 `json:"xp" sql:"xp"` Level LevelType `json:"level" sql:"level"` Tier TierType `json:"tier" sql:"tier"` Rank RankType `json:"user_rank" sql:"user_rank"` Coffee uint64 `json:"coffee" sql:"coffee"` SavedPosts []string `json:"saved_posts,omitempty" sql:"saved_posts"` FirstName string `json:"first_name" sql:"first_name"` LastName string `json:"last_name" sql:"last_name"` CreatedAt time.Time `json:"created_at" sql:"created_at"` FollowerCount uint64 `json:"follower_count" sql:"follower_count"` HighestScore uint64 `json:"highest_score" sql:"highest_score"` Timezone string `json:"timezone" sql:"timezone"` BroadcastThreshold uint64 `json:"broadcast_threshold" sql:"broadcast_threshold"` AvatarReward *string `json:"avatar_reward" sql:"avatar_reward"` ExclusiveAgreement bool `json:"exclusive_agreement" sql:"exclusive_agreement"` ResetToken *string `json:"reset_token" sql:"reset_token"` HasBroadcast bool `json:"has_broadcast" sql:"has_broadcast"` HolidayThemes bool `json:"holiday_themes" sql:"holiday_themes"` }
type UserRewardsInventory ¶
type UserSQL ¶
type UserSQL struct { ID int64 `json:"_id" sql:"_id"` UserName string `json:"user_name" sql:"user_name"` Password string `json:"password"` Email string `json:"email" sql:"email"` Phone string `json:"phone" sql:"phone"` UserStatus UserStatus `json:"user_status" sql:"user_status"` Bio string `json:"bio" sql:"bio"` XP uint64 `json:"xp" sql:"xp"` Level LevelType `json:"level" sql:"level"` Tier TierType `json:"tier" sql:"tier"` Rank RankType `json:"user_rank" sql:"user_rank"` Coffee uint64 `json:"coffee" sql:"coffee"` FirstName string `json:"first_name" sql:"first_name"` LastName string `json:"last_name" sql:"last_name"` GiteaID int64 `json:"gitea_id" sql:"gitea_id"` CreatedAt time.Time `json:"created_at" sql:"created_at"` WorkspaceSettings []byte `json:"workspace_settings" sql:"workspace_settings"` EncryptedServiceKey []byte `json:"encrypted_service_key" sql:"encrypted_service_key"` StartUserInfo []byte `json:"start_user_info" sql:"start_user_info"` HighestScore uint64 `json:"highest_score" sql:"highest_score"` Timezone string `json:"timezone" sql:"timezone"` AvatarSettings []byte `json:"avatar_settings" sql:"avatar_settings"` BroadcastThreshold uint64 `json:"broadcast_threshold" sql:"broadcast_threshold"` AvatarReward *int64 `json:"avatar_reward" sql:"avatar_reward"` ExclusiveAgreement bool `json:"exclusive_agreement" sql:"exclusive_agreement"` ResetToken *string `json:"reset_token" sql:"reset_token"` HasBroadcast bool `json:"has_broadcast" sql:"has_broadcast"` HolidayThemes bool `json:"holiday_themes" sql:"holiday_themes"` Tutorials []byte `json:"tutorials" sql:"tutorials"` IsEphemeral bool `json:"is_ephemeral" sql:"is_ephemeral"` // Auth Otp *string `json:"otp,omitempty" sql:"otp"` OtpValidated *bool `json:"otp_validated,omitempty" sql:"otp_validated"` AuthRole AuthenticationRole `json:"auth_role" sql:"auth_role"` ExternalAuth string `json:"external_auth" sql:"external_auth"` StripeUser *string `json:"stripe_user" sql:"stripe_user"` StripeAccount *string `json:"stripe_account" sql:"stripe_account"` StripeSubscription *string `json:"stripe_subscription" sql:"stripe_subscription"` FollowerCount uint64 `json:"follower_count" sql:"follower_count"` }
type UserSearch ¶
type UserSession ¶
type UserSession struct { ID int64 `json:"_id"` UserID int64 `json:"user_id"` Started time.Time `json:"started"` Expiration time.Time `json:"expiration"` EncryptedServiceKey string `json:"encrypted_service_key"` SessionKey *UserSessionKey `json:"session_key,omitempty"` }
UserSession
UserSessions are used to manage ephemeral data for a user's session. This includes the ephemeral service key. UserSessions are store in redis for the duration of a session or until their expiration. Once a user session has expired the user for that session should be required to login before continuing interactions on the system.
func CreateUserSession ¶
func LoadUserSession ¶
func LoadUserSession(db *ti.Database, rdb redis.UniversalClient, userId int64) (*UserSession, error)
LoadUserSession
Loads existing user session from redis and its key from sql. If there is no session for the passed user an error of "no session" is returned
func (*UserSession) GetServiceKey ¶
func (s *UserSession) GetServiceKey() (string, error)
GetServiceKey
Decrypts the EncryptedServiceKey using the SessionKey and returns the plain-text service key
type UserSessionKey ¶
type UserSessionKey struct { ID int64 `sql:"_id"` Key string `sql:"_key"` Expiration time.Time `sql:"expiration"` }
func CreateUserSessionKey ¶
func CreateUserSessionKey(id int64, key string, expiration time.Time) *UserSessionKey
func UserSessionKeyFromSQLNative ¶
func UserSessionKeyFromSQLNative(rows *sql.Rows) (*UserSessionKey, error)
func (*UserSessionKey) ToSQLNative ¶
func (k *UserSessionKey) ToSQLNative() ([]SQLInsertStatement, error)
type UserStats ¶
type UserStats struct { ID int64 `json:"id" sql:"_id"` UserID int64 `json:"user_id" sql:"user_id"` ChallengesCompleted int `json:"challenges_completed" sql:"challenges_completed"` StreakActive bool `json:"streak_active" sql:"streak_active"` CurrentStreak int `json:"current_streak" sql:"current_streak"` LongestStreak int `json:"longest_streak" sql:"longest_streak"` TotalTimeSpent time.Duration `json:"total_time_spent" sql:"total_time_spent"` AvgTime time.Duration `json:"avg_time" sql:"avg_time"` DailyIntervals []*DailyUsage `json:"daily_intervals" sql:"daily_intervals"` DaysOnPlatform int `json:"days_on_platform" sql:"days_on_platform"` DaysOnFire int `json:"days_on_fire" sql:"days_on_fire"` StreakFreezes int `json:"streak_freezes" sql:"streak_freezes"` StreakFreezeUsed bool `json:"streak_freeze_used" sql:"streak_freeze_used"` XpGained int64 `json:"xp_gained" sql:"xp_gained"` Date time.Time `json:"date" sql:"date"` Expiration time.Time `json:"expiration" sql:"expiration"` Closed bool `json:"closed" sql:"closed"` }
func CreateUserStats ¶
func CreateUserStats(id int64, userId int64, challengesCompleted int, streakActive bool, currentStreak int, longestStreak int, totalTimeSpent time.Duration, avgTime time.Duration, daysOnPlatform int, daysOnFire int, streakFreezes int, date time.Time, expiration time.Time, dailyUse []*DailyUsage) (*UserStats, error)
func UserStatsFromSQLNative ¶
func (*UserStats) ToFrontend ¶
func (i *UserStats) ToFrontend() *UserStatsFrontend
func (*UserStats) ToSQLNative ¶
func (i *UserStats) ToSQLNative() []*SQLInsertStatement
type UserStatsFrontend ¶
type UserStatsFrontend struct { ID string `json:"id" sql:"_id"` UserID string `json:"user_id" sql:"user_id"` ChallengesCompleted string `json:"challenges_completed" sql:"challenges_completed"` StreakActive bool `json:"streak_active" sql:"streak_active"` CurrentStreak string `json:"current_streak" sql:"current_streak"` LongestStreak string `json:"longest_streak" sql:"longest_streak"` TotalTimeSpent time.Duration `json:"total_time_spent" sql:"total_time_spent"` AvgTime time.Duration `json:"avg_time" sql:"avg_time"` DaysOnPlatform int `json:"days_on_platform" sql:"days_on_platform"` DaysOnFire int `json:"days_on_fire" sql:"days_on_fire"` StreakFreezes int `json:"streak_freezes" sql:"streak_freezes"` StreakFreezeUsed bool `json:"streak_freeze_used" sql:"streak_freeze_used"` XpGained string `json:"xp_gained" sql:"xp_gained"` Date time.Time `json:"date" sql:"date"` Closed bool `json:"closed" sql:"closed"` }
type UserStatsSQL ¶
type UserStatsSQL struct { ID int64 `json:"id" sql:"_id"` UserID int64 `json:"user_id" sql:"user_id"` ChallengesCompleted int `json:"challenges_completed" sql:"challenges_completed"` StreakActive bool `json:"streak_active" sql:"streak_active"` CurrentStreak int `json:"current_streak" sql:"current_streak"` LongestStreak int `json:"longest_streak" sql:"longest_streak"` TotalTimeSpent time.Duration `json:"total_time_spent" sql:"total_time_spent"` AvgTime time.Duration `json:"avg_time" sql:"avg_time"` DaysOnPlatform int `json:"days_on_platform" sql:"days_on_platform"` DaysOnFire int `json:"days_on_fire" sql:"days_on_fire"` StreakFreezes int `json:"streak_freezes" sql:"streak_freezes"` StreakFreezeUsed bool `json:"streak_freeze_used" sql:"streak_freeze_used"` XpGained int64 `json:"xp_gained" sql:"xp_gained"` Date time.Time `json:"date" sql:"date"` Expiration time.Time `json:"expiration" sql:"expiration"` Closed bool `json:"closed" sql:"closed"` // Convenience fields for common queries OpenSession int `json:"open_session" sql:"open_session"` Timezone string `json:"timezone" sql:"timezone"` }
type UserStatus ¶
type UserStatus int
const ( UserStatusBasic UserStatus = iota UserStatusPremium )
func (UserStatus) String ¶
func (s UserStatus) String() string
type UserTutorial ¶
type UserTutorial struct { All bool `json:"all" sql:"all"` Home bool `json:"home" sql:"home"` Challenge bool `json:"challenge" sql:"challenge"` Workspace bool `json:"workspace" sql:"workspace"` Nemesis bool `json:"nemesis" sql:"nemesis"` Stats bool `json:"stats" sql:"stats"` CreateProject bool `json:"create_project" sql:"create_project"` Launchpad bool `json:"launchpad" sql:"launchpad"` Vscode bool `json:"vscode" sql:"vscode"` }
type VolpoolVolume ¶
type VolpoolVolume struct { // ID Unique identifier of the volume ID int64 `json:"_id" sql:"_id"` // Size Size of the volume in gigabytes Size int `json:"size" sql:"size"` // State Current state of the volume State VolumeState `json:"state" sql:"state"` // PVCName Name of the PVC that owns the volume PVCName string `json:"pvc_name" sql:"pvc_name"` // StorageClass Name of the storage class that owns the volume StorageClass string `json:"storage_class" sql:"storage_class"` // WorkspaceID ID of the workspace that owns the volume WorkspaceID *int64 `json:"workspace_id" sql:"workspace_id"` }
Volume
Represents a valume that has been pre-provisioned by the volume pool
func CreateVolpoolVolume ¶
func CreateVolpoolVolume(_id int64, size int, state VolumeState, pvcName string, storageClass string, workspaceId *int64) *VolpoolVolume
func VolpoolVolumeFromSqlNative ¶
func VolpoolVolumeFromSqlNative(rows *sql.Rows) (*VolpoolVolume, error)
func (*VolpoolVolume) ToSqlNative ¶
func (v *VolpoolVolume) ToSqlNative() ([]SQLInsertStatement, error)
type VolumeState ¶
type VolumeState int
const ( VolumeStateAvailable VolumeState = iota VolumeStateInUse )
type Workspace ¶
type Workspace struct { ID int64 `json:"_id" sql:"_id"` CodeSourceID int64 `json:"code_source_id" sql:"code_source_id"` CodeSourceType CodeSource `json:"code_source_type" sql:"code_source_type"` RepoID int64 `json:"repo_id" sql:"repo_id"` CreatedAt time.Time `json:"created_at" sql:"created_at"` OwnerID int64 `json:"owner_id" sql:"owner_id"` TemplateID int64 `json:"template_id" sql:"template_id"` Expiration time.Time `json:"expiration" sql:"expiration"` Commit string `json:"commit" sql:"commit"` State WorkspaceState `json:"state" sql:"state"` InitState WorkspaceInitState `json:"init_state" sql:"init_state"` InitFailure *WorkspaceInitFailure `json:"init_failure" sql:"init_failure"` LastStateUpdate time.Time `json:"last_state_update" sql:"last_state_update"` WorkspaceSettings *WorkspaceSettings `json:"workspace_settings" sql:"workspace_settings"` OverAllocated *OverAllocated `json:"over_allocated" sql:"over_allocated"` Ports []WorkspacePort `json:"ports" sql:"ports"` IsEphemeral bool `json:"is_ephemeral" sql:"is_ephemeral"` }
func CreateWorkspace ¶
func CreateWorkspace(id int64, repoId int64, codeSourceId int64, codeSourceType CodeSource, createdAt time.Time, ownerId int64, templateId int64, expiration time.Time, commit string, settings *WorkspaceSettings, overAllocated *OverAllocated, ports []WorkspacePort) (*Workspace, error)
func (*Workspace) ToFrontend ¶
func (w *Workspace) ToFrontend(hostname string, https bool) *WorkspaceFrontend
func (*Workspace) ToSQLNative ¶
func (w *Workspace) ToSQLNative() ([]*SQLInsertStatement, error)
type WorkspaceAgent ¶
type WorkspaceAgent struct { ID int64 `json:"_id" sql:"_id"` CreatedAt time.Time `json:"created_at" sql:"created_at"` UpdatedAt time.Time `json:"updated_at" sql:"updated_at"` FirstConnect *time.Time `json:"first_connect" sql:"firs_connect"` LastConnect *time.Time `json:"last_connect" sql:"last_connect"` LastDisconnect *time.Time `json:"last_disconnect" sql:"last_disconnect"` LastConnectedNode int64 `json:"last_connected_node" sql:"last_connected_node"` DisconnectCount int `json:"disconnect_count" sql:"disconnect_count"` State WorkspaceAgentState `json:"state" sql:"state"` WorkspaceID int64 `json:"workspace_id" sql:"workspace_id"` Version string `json:"version" sql:"version"` OwnerID int64 `json:"owner_id" sql:"owner_id"` Secret uuid.UUID `json:"secret" sql:"secret"` }
func CreateWorkspaceAgent ¶
func WorkspaceAgentFromSQLNative ¶
func WorkspaceAgentFromSQLNative(rows *sql.Rows) (*WorkspaceAgent, error)
func (*WorkspaceAgent) ToSQLNative ¶
func (a *WorkspaceAgent) ToSQLNative() []*SQLInsertStatement
type WorkspaceAgentState ¶
type WorkspaceAgentState int
const ( WorkspaceAgentStateUnknown WorkspaceAgentState = 0 WorkspaceAgentStateStarting WorkspaceAgentState = 1 WorkspaceAgentStateRunning WorkspaceAgentState = 2 WorkspaceAgentStateStopping WorkspaceAgentState = 3 WorkspaceAgentStateStopped WorkspaceAgentState = 4 WorkspaceAgentStateFailed WorkspaceAgentState = 5 WorkspaceAgentStateTimeout WorkspaceAgentState = 6 )
func (WorkspaceAgentState) String ¶
func (s WorkspaceAgentState) String() string
type WorkspaceAgentStats ¶
type WorkspaceAgentStats struct { ID int64 `json:"_id" sql:"_id"` AgentID int64 `json:"agent_id" sql:"agent_id"` WorkspaceID int64 `json:"workspace_id" sql:"workspace_id"` Timestamp time.Time `json:"timestamp" sql:"timestamp"` // ConnsByProto is a count of connections by protocol. ConnsByProto map[string]int64 `json:"conns_by_proto" sql:"conns_by_proto"` // NumConns is the number of connections received by an agent. NumConns int64 `json:"num_comms" sql:"num_comms"` // RxPackets is the number of received packets. RxPackets int64 `json:"rx_packets" sql:"rx_packets"` // RxBytes is the number of received bytes. RxBytes int64 `json:"rx_bytes" sql:"rx_bytes"` // TxPackets is the number of transmitted bytes. TxPackets int64 `json:"tx_packets" sql:"tx_packets"` // TxBytes is the number of transmitted bytes. TxBytes int64 `json:"tx_bytes" sql:"tx_bytes"` }
func WorkspaceAgentStatsFromSQLNative ¶
func WorkspaceAgentStatsFromSQLNative(rows *sql.Rows) (*WorkspaceAgentStats, error)
func (*WorkspaceAgentStats) ToSQLNative ¶
func (s *WorkspaceAgentStats) ToSQLNative() ([]*SQLInsertStatement, error)
type WorkspaceAgentStatsSQL ¶
type WorkspaceAgentStatsSQL struct { ID int64 `sql:"_id"` AgentID int64 `sql:"agent_id"` WorkspaceID int64 `sql:"workspace_id"` Timestamp time.Time `sql:"timestamp"` ConnsByProto []byte `sql:"conns_by_proto"` NumConns int64 `sql:"num_comms"` RxPackets int64 `sql:"rx_packets"` RxBytes int64 `sql:"rx_bytes"` TxPackets int64 `sql:"tx_packets"` TxBytes int64 `sql:"tx_bytes"` }
type WorkspaceConfig ¶
type WorkspaceConfig struct { ID int64 `json:"_id" sql:"_id"` Title string `json:"title" sql:"title"` Description string `json:"description" sql:"description"` Content string `json:"content" sql:"content"` AuthorID int64 `json:"author_id" sql:"author_id"` Revision int `json:"revision" sql:"revision"` Official bool `json:"official" sql:"official"` Tags []int64 `json:"tags" sql:"tags"` Languages []ProgrammingLanguage `json:"languages" sql:"languages"` }
func CreateWorkspaceConfig ¶
func CreateWorkspaceConfig(_id int64, title string, description string, content string, authorID int64, revision int, tags []int64, languages []ProgrammingLanguage) *WorkspaceConfig
func (*WorkspaceConfig) ToFrontend ¶
func (c *WorkspaceConfig) ToFrontend() *WorkspaceConfigFrontend
func (*WorkspaceConfig) ToSQLNative ¶
func (c *WorkspaceConfig) ToSQLNative() ([]*SQLInsertStatement, error)
type WorkspaceConfigFrontend ¶
type WorkspaceConfigFrontend struct { ID string `json:"_id"` Title string `json:"title" sql:"title"` Description string `json:"description"` Content string `json:"content"` AuthorID string `json:"author_id"` Author string `json:"author"` Revision int `json:"revision"` Official bool `json:"official"` Tags []string `json:"tags"` Languages []ProgrammingLanguage `json:"languages"` LanguageStrings []string `json:"languages_strings"` }
type WorkspaceConfigSQL ¶
type WorkspaceConfigSQL struct { ID int64 `json:"_id" sql:"_id"` Title string `json:"title" sql:"title"` Description string `json:"description" sql:"description"` Content string `json:"content" sql:"content"` AuthorID int64 `json:"author_id" sql:"author_id"` Revision int `json:"revision" sql:"revision"` Official bool `json:"official" sql:"official"` }
type WorkspaceFrontend ¶
type WorkspaceFrontend struct { ID string `json:"_id"` CodeSourceID string `json:"code_source_id"` CodeSourceType CodeSource `json:"code_source_type"` CodeSourceTypeString string `json:"code_source_type_string"` RepoID string `json:"repo_id"` CreatedAt string `json:"created_at"` OwnerID string `json:"owner_id"` Expiration string `json:"expiration"` Commit string `json:"commit"` State WorkspaceState `json:"state"` StateString string `json:"state_string"` InitState WorkspaceInitState `json:"init_state"` InitStateString string `json:"init_state_string"` InitFailure *WorkspaceInitFailure `json:"init_failure"` WorkspaceSettings *WorkspaceSettings `json:"workspace_settings"` OverAllocated *OverAllocated `json:"over_allocated" sql:"over_allocated"` Ports []WorkspacePortFrontend `json:"ports"` IsEphemeral bool `json:"is_ephemeral" sql:"is_ephemeral"` }
type WorkspaceInitFailure ¶
type WorkspaceInitState ¶
type WorkspaceInitState int
const ( WorkspaceInitProvisioning WorkspaceInitState = iota WorkspaceInitRemoteInitialization WorkspaceInitWriteGitConfig WorkspaceInitWriteWorkspaceConfig WorkspaceInitGitClone WorkspaceInitGitCheckout WorkspaceInitCreateContainerDirectory WorkspaceInitWriteContainerCompose WorkspaceInitContainerComposeUp WorkspaceInitVSCodeInstall WorkspaceInitVSCodeExtensionInstall WorkspaceInitShellExecutions WorkspaceInitVSCodeLaunch WorkspaceInitCompleted WorkspaceInitReadExistingWorkspaceConfig )
func (WorkspaceInitState) String ¶
func (w WorkspaceInitState) String() string
type WorkspacePort ¶
type WorkspacePort struct { Name string `json:"name"` Port uint16 `json:"port"` Configured bool `json:"configured"` Active bool `json:"active"` }
func (*WorkspacePort) ToFrontend ¶
func (p *WorkspacePort) ToFrontend(userId int64, workspaceId int64, hostname string, https bool) *WorkspacePortFrontend
type WorkspacePortFrontend ¶
type WorkspaceSQL ¶
type WorkspaceSQL struct { ID int64 `json:"_id" sql:"_id"` CodeSourceID int64 `json:"code_source_id" sql:"code_source_id"` CodeSourceType CodeSource `json:"code_source_type" sql:"code_source_type"` RepoID int64 `json:"repo_id" sql:"repo_id"` CreatedAt time.Time `json:"created_at" sql:"created_at"` OwnerID int64 `json:"owner_id" sql:"owner_id"` TemplateID int64 `json:"template_id" sql:"template_id"` Expiration time.Time `json:"expiration" sql:"expiration"` Commit string `json:"commit" sql:"commit"` State WorkspaceState `json:"state" sql:"state"` InitState WorkspaceInitState `json:"init_state" sql:"init_state"` InitFailure []byte `json:"init_failure" sql:"init_failure"` LastStateUpdate time.Time `json:"last_state_update" sql:"last_state_update"` WorkspaceSettings []byte `json:"workspace_settings" sql:"workspace_settings"` OverAllocated []byte `json:"over_allocated" sql:"over_allocated"` Ports []byte `json:"ports" sql:"ports"` IsEphemeral bool `json:"is_ephemeral" sql:"is_ephemeral"` }
type WorkspaceSettings ¶
type WorkspaceSettings struct {
AutoGit AutoGitSettings `json:"auto_git"`
}
type WorkspaceState ¶
type WorkspaceState int
const ( WorkspaceStarting WorkspaceState = iota WorkspaceActive WorkspaceStopping WorkspaceSuspended WorkspaceRemoving WorkspaceFailed WorkspaceDeleted )
func (WorkspaceState) String ¶
func (w WorkspaceState) String() string
type XPBoost ¶
type XPBoost struct { ID int64 `json:"id" sql:"_id"` UserID int64 `json:"user_id" sql:"user_id"` EndDate *time.Time `json:"end_date" sql:"end_date"` }
func XPBoostFromSQLNative ¶
func (*XPBoost) ToFrontend ¶
func (i *XPBoost) ToFrontend() *XPBoostFrontend
func (*XPBoost) ToSQLNative ¶
func (i *XPBoost) ToSQLNative() []*SQLInsertStatement
type XPBoostFrontend ¶
type XPBoostSQL ¶
type XPReason ¶
type XPReason struct { ID int64 `json:"id" sql:"_id"` UserID int64 `json:"user_id" sql:"user_id"` Date *time.Time `json:"date" sql:"date"` Reason string `json:"reason" sql:"reason"` XP int64 `json:"xp" sql:"xp"` }
func CreateXPReason ¶
func XPReasonFromSQLNative ¶
func (*XPReason) ToFrontend ¶
func (i *XPReason) ToFrontend() *XPReasonFrontend
func (*XPReason) ToSQLNative ¶
func (i *XPReason) ToSQLNative() []*SQLInsertStatement
type XPReasonFrontend ¶
Source Files
¶
- attempt.go
- avatar_settings.go
- award.go
- broadcast_event.go
- chat.go
- chat_message.go
- coffee.go
- comment.go
- comment_background.go
- curated_post.go
- discussion.go
- discussion_background.go
- exclusive_content_purchases.go
- follower.go
- friend_requests.go
- friends.go
- implicit_rec.go
- model.go
- nemesis.go
- notification.go
- post.go
- recommended_post.go
- renown.go
- report_issue.go
- rewards.go
- search_rec.go
- session.go
- starter_user_info.go
- stats.go
- stats_xp.go
- tag.go
- thread_comment.go
- thread_reply.go
- up_vote.go
- user.go
- user_free_premium.go
- user_session_key.go
- volpool_volume.go
- workspace.go
- workspace_agent.go
- workspace_agent_stats.go
- workspace_config.go
- workspace_settings.go
- xp_boost.go
- xp_reason.go
Click to show internal directories.
Click to hide internal directories.