Documentation
¶
Index ¶
- type Account
- func (account *Account) Create() *gorm.DB
- func (Account) DeleteByIDs(ids []interface{}) *gorm.DB
- func (account *Account) ReadByEmail() *gorm.DB
- func (Account) ReadByEmails(emails []interface{}, list *[]Account) *gorm.DB
- func (account *Account) ReadByUUID() *gorm.DB
- func (account *Account) UpdateByEmailAndUUID(m map[string]interface{}) *gorm.DB
- func (account *Account) UpdateIsEmailVerifiedToTrueByAccountUUID() *gorm.DB
- func (account *Account) UpdatePasswordByEmail(password string) *gorm.DB
- type AccountOauthInfo
- func (accountOAuthInfo *AccountOauthInfo) Create() *gorm.DB
- func (AccountOauthInfo) DeleteByAccountIDs(ids []interface{}) *gorm.DB
- func (a AccountOauthInfo) ReadAllByAccountUUID(accountUUID string, list *[]AccountOauthInfo) *gorm.DB
- func (accountOAuthInfo *AccountOauthInfo) ReadByEmailAndProvider() *gorm.DB
- type AccountProfile
- func (accountProfile *AccountProfile) Create() *gorm.DB
- func (AccountProfile) DeleteByAccountIDs(ids []interface{}) *gorm.DB
- func (AccountProfile) ReadAllByAccountUUIDs(accountUuids []interface{}, list *[]AccountProfile) *gorm.DB
- func (accountProfile *AccountProfile) ReadByAccountUUID() *gorm.DB
- func (accountProfile *AccountProfile) UpdateByAccountUUID(m map[string]interface{}) *gorm.DB
- type AccountProfileSocialMedia
- func (AccountProfileSocialMedia) DeleteByAccountIDs(ids []interface{}) *gorm.DB
- func (a AccountProfileSocialMedia) ReadAllByAccountUUID(accountUUID string, list *[]AccountProfileSocialMedia) *gorm.DB
- func (accountProfileSocialMedia *AccountProfileSocialMedia) UpdateOrCreateByAccountUUIDAndProvider(m map[string]interface{}) *gorm.DB
- type AccountSetting
- func (accountSetting *AccountSetting) Create() *gorm.DB
- func (AccountSetting) DeleteByAccountIDs(ids []interface{}) *gorm.DB
- func (AccountSetting) ReadAllByAccountUUIDs(accountUuids []interface{}, list *[]AccountSetting) *gorm.DB
- func (accountSetting *AccountSetting) ReadByAccountUUID() *gorm.DB
- func (accountSetting *AccountSetting) UpdateByAccountUUID(m map[string]interface{}) *gorm.DB
- type AccountSettingNotification
- func (accountSettingNotification *AccountSettingNotification) Create() *gorm.DB
- func (AccountSettingNotification) DeleteByAccountIDs(ids []interface{}) *gorm.DB
- func (accountSettingNotification *AccountSettingNotification) ReadByAccountUUID() *gorm.DB
- func (accountSettingNotification *AccountSettingNotification) UpdateByAccountUUID(m map[string]interface{}) *gorm.DB
- type AuthAccountEmailVerification
- type AuthAccountResetPassword
- type AuthCaptcha
- type AuthChatWS
- type ChatMessage
- type ChatRoom
- type ChatRoomInviteCode
- type ChatRoomMember
- func (acr *ChatRoomMember) Create() *gorm.DB
- func (acr ChatRoomMember) ReadAllByAccountUUID(accountUUID string, list *[]ChatRoomMember) *gorm.DB
- func (acr ChatRoomMember) ReadAllByChatRoomID(chatRoomID uint, list *[]ChatRoomMember) *gorm.DB
- func (acr ChatRoomMember) ReadAllByChatRoomIDs(ids []interface{}, list *[]ChatRoomMember) *gorm.DB
- func (acr *ChatRoomMember) ReadByChatRoomIDAndAccountUUID() *gorm.DB
- func (acr *ChatRoomMember) UpdateByChatRoomIDAndAccountUUID(m map[string]interface{}) *gorm.DB
- type Forum
- type JWTToken
- type MongoDBModel
- type Post
- type PostComment
- type PostFavorite
- type PostFollowed
- type PostReaction
- type Session
- type Topic
- type TopicFollowed
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Account ¶
type Account struct { gorm.Model UUID string `gorm:"unique; not null;"` Email string `gorm:"unique; not null;"` Password string IsEmailVerified bool `gorm:"default:false;"` }
func (Account) DeleteByIDs ¶
func (*Account) ReadByEmail ¶
func (Account) ReadByEmails ¶
func (*Account) ReadByUUID ¶
func (*Account) UpdateByEmailAndUUID ¶
func (*Account) UpdateIsEmailVerifiedToTrueByAccountUUID ¶
type AccountOauthInfo ¶
type AccountOauthInfo struct { gorm.Model AccountID uint `gorm:"not null"` AccountUUID string `gorm:"not null"` Provider string `gorm:"not null"` Email string `gorm:"not null"` }
func (*AccountOauthInfo) Create ¶
func (accountOAuthInfo *AccountOauthInfo) Create() *gorm.DB
func (AccountOauthInfo) DeleteByAccountIDs ¶
func (AccountOauthInfo) DeleteByAccountIDs(ids []interface{}) *gorm.DB
func (AccountOauthInfo) ReadAllByAccountUUID ¶
func (a AccountOauthInfo) ReadAllByAccountUUID(accountUUID string, list *[]AccountOauthInfo) *gorm.DB
func (*AccountOauthInfo) ReadByEmailAndProvider ¶
func (accountOAuthInfo *AccountOauthInfo) ReadByEmailAndProvider() *gorm.DB
type AccountProfile ¶
type AccountProfile struct { gorm.Model AccountID uint `gorm:"unique; not null;"` AccountUUID string `gorm:"unique; not null;"` Avatar string Banner string Signature string }
func (*AccountProfile) Create ¶
func (accountProfile *AccountProfile) Create() *gorm.DB
func (AccountProfile) DeleteByAccountIDs ¶
func (AccountProfile) DeleteByAccountIDs(ids []interface{}) *gorm.DB
func (AccountProfile) ReadAllByAccountUUIDs ¶
func (AccountProfile) ReadAllByAccountUUIDs(accountUuids []interface{}, list *[]AccountProfile) *gorm.DB
func (*AccountProfile) ReadByAccountUUID ¶
func (accountProfile *AccountProfile) ReadByAccountUUID() *gorm.DB
func (*AccountProfile) UpdateByAccountUUID ¶
func (accountProfile *AccountProfile) UpdateByAccountUUID(m map[string]interface{}) *gorm.DB
type AccountProfileSocialMedia ¶
type AccountProfileSocialMedia struct { ID uint `gorm:"primarykey"` AccountID uint `gorm:"not null"` AccountUUID string `gorm:"not null"` Provider string `gorm:"not null"` UserName string `gorm:"not null"` }
func (AccountProfileSocialMedia) DeleteByAccountIDs ¶
func (AccountProfileSocialMedia) DeleteByAccountIDs(ids []interface{}) *gorm.DB
func (AccountProfileSocialMedia) ReadAllByAccountUUID ¶
func (a AccountProfileSocialMedia) ReadAllByAccountUUID(accountUUID string, list *[]AccountProfileSocialMedia) *gorm.DB
func (*AccountProfileSocialMedia) UpdateOrCreateByAccountUUIDAndProvider ¶
func (accountProfileSocialMedia *AccountProfileSocialMedia) UpdateOrCreateByAccountUUIDAndProvider(m map[string]interface{}) *gorm.DB
type AccountSetting ¶
type AccountSetting struct { gorm.Model AccountID uint `gorm:"unique; not null;"` AccountUUID string `gorm:"unique; not null;"` Name string Locale string }
func (*AccountSetting) Create ¶
func (accountSetting *AccountSetting) Create() *gorm.DB
func (AccountSetting) DeleteByAccountIDs ¶
func (AccountSetting) DeleteByAccountIDs(ids []interface{}) *gorm.DB
func (AccountSetting) ReadAllByAccountUUIDs ¶
func (AccountSetting) ReadAllByAccountUUIDs(accountUuids []interface{}, list *[]AccountSetting) *gorm.DB
func (*AccountSetting) ReadByAccountUUID ¶
func (accountSetting *AccountSetting) ReadByAccountUUID() *gorm.DB
func (*AccountSetting) UpdateByAccountUUID ¶
func (accountSetting *AccountSetting) UpdateByAccountUUID(m map[string]interface{}) *gorm.DB
type AccountSettingNotification ¶
type AccountSettingNotification struct { ID uint `gorm:"primarykey"` AccountID uint `gorm:"unique; not null;"` AccountUUID string `gorm:"unique; not null;"` FollowOrOwnArticleReply uint `gorm:"default:1"` CommentTagged bool `gorm:"default:true"` ArticleTweet bool `gorm:"default:true"` CommentTweet bool `gorm:"default:true"` InterestRecommendation bool `gorm:"default:true"` Chat bool `gorm:"default:true"` Followed bool `gorm:"default:true"` }
func (*AccountSettingNotification) Create ¶
func (accountSettingNotification *AccountSettingNotification) Create() *gorm.DB
func (AccountSettingNotification) DeleteByAccountIDs ¶
func (AccountSettingNotification) DeleteByAccountIDs(ids []interface{}) *gorm.DB
func (*AccountSettingNotification) ReadByAccountUUID ¶
func (accountSettingNotification *AccountSettingNotification) ReadByAccountUUID() *gorm.DB
func (*AccountSettingNotification) UpdateByAccountUUID ¶
func (accountSettingNotification *AccountSettingNotification) UpdateByAccountUUID(m map[string]interface{}) *gorm.DB
type AuthAccountEmailVerification ¶
type AuthAccountEmailVerification struct { AccountUUID string Token string Code string Result string }
Redis
func (*AuthAccountEmailVerification) Create ¶
func (aaev *AuthAccountEmailVerification) Create() error
func (*AuthAccountEmailVerification) Delete ¶
func (aaev *AuthAccountEmailVerification) Delete() error
func (*AuthAccountEmailVerification) IsMatch ¶
func (aaev *AuthAccountEmailVerification) IsMatch() bool
func (*AuthAccountEmailVerification) Read ¶
func (aaev *AuthAccountEmailVerification) Read() error
func (*AuthAccountEmailVerification) Update ¶
func (aaev *AuthAccountEmailVerification) Update() error
type AuthAccountResetPassword ¶
Redis
func (*AuthAccountResetPassword) Create ¶
func (aarp *AuthAccountResetPassword) Create() error
func (*AuthAccountResetPassword) Delete ¶
func (aarp *AuthAccountResetPassword) Delete() error
func (*AuthAccountResetPassword) IsMatch ¶
func (aarp *AuthAccountResetPassword) IsMatch() bool
func (*AuthAccountResetPassword) Read ¶
func (aarp *AuthAccountResetPassword) Read() error
func (*AuthAccountResetPassword) Update ¶
func (aarp *AuthAccountResetPassword) Update() error
type AuthCaptcha ¶
Redis
func (*AuthCaptcha) Create ¶
func (ac *AuthCaptcha) Create() error
func (*AuthCaptcha) Delete ¶
func (ac *AuthCaptcha) Delete() error
func (*AuthCaptcha) ReadByUUID ¶
func (ac *AuthCaptcha) ReadByUUID() error
func (*AuthCaptcha) UpdateByUUID ¶
func (ac *AuthCaptcha) UpdateByUUID() error
type AuthChatWS ¶
func (*AuthChatWS) Create ¶
func (acws *AuthChatWS) Create() error
func (*AuthChatWS) Delete ¶
func (acws *AuthChatWS) Delete() error
func (*AuthChatWS) Read ¶
func (acws *AuthChatWS) Read() error
type ChatMessage ¶
type ChatMessage struct { ID primitive.ObjectID `bson:"_id,omitempty"` From string To uint Type string Content string Timestamp time.Time }
func (ChatMessage) FindByTo ¶
func (ChatMessage) FindByTo(to uint) ([]*ChatMessage, error)
func (*ChatMessage) InsertOne ¶
func (m *ChatMessage) InsertOne() (*mongo.InsertOneResult, error)
type ChatRoom ¶
type ChatRoom struct { gorm.Model Type string `gorm:"not null;"` MaximumMemberNum int `gorm:"default:50;not null;"` Emoji string Name string Avatar string }
func (ChatRoom) ReadAllByIDs ¶
type ChatRoomInviteCode ¶
Redis
func (*ChatRoomInviteCode) Create ¶
func (cric *ChatRoomInviteCode) Create() error
func (*ChatRoomInviteCode) Read ¶
func (cric *ChatRoomInviteCode) Read() error
type ChatRoomMember ¶
type ChatRoomMember struct { ID uint `gorm:"primarykey"` ChatRoomID uint `gorm:"not null;"` AccountUUID string `gorm:"not null;"` Theme string EnabledNotification bool `gorm:"default:true; not null;"` LastSeenAt time.Time }
func (*ChatRoomMember) Create ¶
func (acr *ChatRoomMember) Create() *gorm.DB
func (ChatRoomMember) ReadAllByAccountUUID ¶
func (acr ChatRoomMember) ReadAllByAccountUUID(accountUUID string, list *[]ChatRoomMember) *gorm.DB
func (ChatRoomMember) ReadAllByChatRoomID ¶
func (acr ChatRoomMember) ReadAllByChatRoomID(chatRoomID uint, list *[]ChatRoomMember) *gorm.DB
func (ChatRoomMember) ReadAllByChatRoomIDs ¶
func (acr ChatRoomMember) ReadAllByChatRoomIDs(ids []interface{}, list *[]ChatRoomMember) *gorm.DB
func (*ChatRoomMember) ReadByChatRoomIDAndAccountUUID ¶
func (acr *ChatRoomMember) ReadByChatRoomIDAndAccountUUID() *gorm.DB
func (*ChatRoomMember) UpdateByChatRoomIDAndAccountUUID ¶
func (acr *ChatRoomMember) UpdateByChatRoomIDAndAccountUUID(m map[string]interface{}) *gorm.DB
type Forum ¶
type Forum struct { MongoDBModel `bson:",inline"` Name string Icon string Banner string Rule string Description string PopularTopics []string `bson:"popular_topics"` }
func (*Forum) FindOneByID ¶
func (*Forum) FindOneByName ¶
type JWTToken ¶
func ParseJWTToken ¶
type MongoDBModel ¶
type MongoDBModel struct { ID primitive.ObjectID `bson:"_id,omitempty"` CreatedAt time.Time `bson:"created_at"` UpdatedAt time.Time `bson:"updated_at"` DeletedAt *time.Time `bson:"deleted_at"` }
作為匿名 nested struct 到各個 struct 時,該 struct 名稱不能是 package level (小寫開頭),要大寫開頭才能正常運作 若該 nested struct 要和其他 struct 同層級的話,要加上 bson inline tag 例如:
type TestingStruct struct { MongoDBModel `bson:",inline"` Name string `bson:"name"` }
type Post ¶
type Post struct { MongoDBModel `bson:",inline"` AccountID uint `bson:"account_id"` IsAnonymous bool `bson:"is_anonymous"` ForumID primitive.ObjectID `bson:"forum_id"` Type string Title string Content string Thumbnail string MasterVision string `bson:"master_vision"` CommentCount int `bson:"comment_count"` Topics []string ReactionStats map[string]int `bson:"reaction_stats"` }
type PostComment ¶
type PostFavorite ¶
type PostFavorite struct { MongoDBModel `bson:",inline"` PostID primitive.ObjectID `bson:"post_id"` AccountID uint `bson:"account_id"` }
type PostFollowed ¶
type PostFollowed struct { MongoDBModel `bson:",inline"` PostID primitive.ObjectID `bson:"post_id"` AccountID uint `bson:"account_id"` }
type PostReaction ¶
type PostReaction struct { MongoDBModel `bson:",inline"` AccountID uint `bson:"account_id"` PostID primitive.ObjectID `bson:"post_id"` Type string }
type Topic ¶
type Topic struct { MongoDBModel `bson:",inline"` Name string PostCount int `bson:"post_count"` FollowedCount int `bson:"followed_count"` }
type TopicFollowed ¶
type TopicFollowed struct { MongoDBModel `bson:",inline"` TopicID primitive.ObjectID `bson:"topic_id"` AccountID uint `bson:"account_id"` }
Source Files
¶
- account.go
- account_oauth_info.go
- account_profile.go
- account_profile_social_media.go
- account_setting.go
- account_setting_notification.go
- auth.go
- chat_messages.go
- chat_room.go
- chat_room_member.go
- forum.go
- models.go
- post.go
- post_comments.go
- post_favorite.go
- post_followed.go
- post_reactions.go
- topic_followed.go
- topics.go
Click to show internal directories.
Click to hide internal directories.