Documentation ¶
Index ¶
- Variables
- type ByCreatedAt
- type CheckinModel
- type Module
- func (module *Module) Get(usr interface{}) (*One, error)
- func (module *Module) GetUserFromRecoveryToken(token string) (*One, error)
- func (module *Module) IsValidRecoveryToken(token string) (bool, error)
- func (module *Module) OauthSignup(provider string, user goth.User) (*One, error)
- func (module *Module) SignUp(email, username, password, referral string) (*One, error)
- type One
- func (self *One) Data() *UserPrivate
- func (self *One) Email() string
- func (o *One) IsValidated() bool
- func (self *One) MarkAsValidated()
- func (self *One) Name() string
- func (self *One) ROwns(entity string, id bson.ObjectId)
- func (self *One) RUpdate(data *UserPrivate)
- func (self *One) TrackUserSignin(client_address string)
- func (self *One) TrackView(entity string, entity_id bson.ObjectId)
- func (self *One) Update(data map[string]interface{}) (err error)
- type Opt
- type Store
- type User
- type UserActivity
- type UserBadge
- type UserBasic
- type UserFollowing
- type UserGaming
- type UserId
- type UserLightModel
- type UserPc
- type UserPrivate
- type UserProfileForm
- type UserRecoveryToken
- type UserRegisterForm
- type UserRole
- type UserSimple
- type UserStats
- type UserSubscribe
- type UserSubscribeForm
- type UserToken
- type ViewModel
Constants ¶
This section is empty.
Variables ¶
View Source
var UserBasicFields bson.M = bson.M{"id": 1, "username": 1, "description": 1, "facebook": 1, "country": 1, "origin_id": 1, "battlenet_id": 1, "steam_id": 1, "email": 1, "validated": 1, "banned": 1, "username_slug": 1, "image": 1, "gaming": 1, "created_at": 1, "updated_at": 1, "last_seen_at": 1}
View Source
var UserSimpleFields bson.M = bson.M{"id": 1, "username": 1, "description": 1, "username_slug": 1, "country": 1, "origin_id": 1, "battlenet_id": 1, "steam_id": 1, "image": 1, "gaming.level": 1, "gaming.swords": 1, "roles": 1, "validated": 1, "created_at": 1, "last_seen_at": 1}
Functions ¶
This section is empty.
Types ¶
type ByCreatedAt ¶
type ByCreatedAt []UserActivity
func (ByCreatedAt) Len ¶
func (a ByCreatedAt) Len() int
func (ByCreatedAt) Less ¶
func (a ByCreatedAt) Less(i, j int) bool
func (ByCreatedAt) Swap ¶
func (a ByCreatedAt) Swap(i, j int)
type CheckinModel ¶
type Module ¶
type Module struct { Errors *exceptions.ExceptionsModule `inject:""` Logger *logging.Logger `inject:""` }
func (*Module) GetUserFromRecoveryToken ¶
func (*Module) IsValidRecoveryToken ¶
func (*Module) OauthSignup ¶
Sign up user from oauth provider
type One ¶
type One struct {
// contains filtered or unexported fields
}
func (*One) IsValidated ¶
func (*One) MarkAsValidated ¶
func (self *One) MarkAsValidated()
func (*One) RUpdate ¶
func (self *One) RUpdate(data *UserPrivate)
Data update only persistent on runtime
func (*One) TrackUserSignin ¶
Helper method to track a signin from the user
type Opt ¶
type Opt func(*UserPrivate)
type User ¶
type User struct { Id bson.ObjectId `bson:"_id,omitempty" json:"id"` UserName string `bson:"username" json:"username"` NameChanges int `bson:"name_changes" json:"name_changes"` Description string `bson:"description" json:"description,omitempty"` Image string `bson:"image" json:"image,omitempty"` Roles []UserRole `bson:"roles" json:"roles,omitempty"` Permissions []string `bson:"permissions" json:"permissions,omitempty"` Profile map[string]interface{} `bson:"profile,omitempty" json:"profile,omitempty"` Gaming UserGaming `bson:"gaming,omitempty" json:"gaming,omitempty"` Version string `bson:"version,omitempty" json:"version,omitempty"` Validated bool `bson:"validated" json:"validated"` Banned bool `bson:"banned" json:"banned"` Created time.Time `bson:"created_at" json:"created_at"` }
type UserActivity ¶
type UserBasic ¶
type UserBasic struct { Id bson.ObjectId `bson:"_id,omitempty" json:"id"` UserName string `bson:"username" json:"username"` UserNameSlug string `bson:"username_slug" json:"username_slug"` Roles []UserRole `bson:"roles" json:"roles,omitempty"` Image string `bson:"image" json:"image,omitempty"` Description string `bson:"description" json:"description"` Email string `bson:"email" json:"email,omitempty"` Facebook interface{} `bson:"facebook,omitempty" json:"facebook,omitempty"` Gaming UserGaming `bson:"gaming,omitempty" json:"gaming,omitempty"` Country string `bson:"country,omitempty" json:"country"` OriginId string `bson:"origin_id,omitempty" json:"origin_id"` BattlenetId string `bson:"battlenet_id,omitempty" json:"battlenet_id"` SteamId string `bson:"steam_id,omitempty" json:"steam_id"` Validated bool `bson:"validated" json:"validated"` Banned bool `bson:"banned" json:"banned"` Created time.Time `bson:"created_at" json:"created_at"` Updated time.Time `bson:"updated_at" json:"updated_at"` Seen *time.Time `bson:"last_seen_at" json:"last_seen_at,omitempty"` }
func (UserBasic) ToSimple ¶
func (u UserBasic) ToSimple() UserSimple
type UserFollowing ¶
type UserFollowing struct { Id bson.ObjectId `bson:"_id,omitempty" json:"id"` Follower bson.ObjectId `bson:"follower,omitempty" json:"follower"` Following bson.ObjectId `bson:"following,omitempty" json:"following"` Notifications bool `bson:"notifications,omitempty" json:"notifications"` Created time.Time `bson:"created_at" json:"created_at"` }
type UserGaming ¶
type UserGaming struct { Swords int `bson:"swords" json:"swords"` Tribute int `bson:"tribute,omitempty" json:"tribute"` Shit int `bson:"shit,omitempty" json:"shit"` Coins int `bson:"coins,omitempty" json:"coins"` Level int `bson:"level" json:"level"` Badges []UserBadge `bson:"badges,omitempty" json:"badges,omitempty"` }
type UserLightModel ¶
type UserPrivate ¶
type UserPrivate struct { User `bson:",inline"` Password string `bson:"password,omitempty" json:"-"` Step int `bson:"step,omitempty" json:"step"` Notifications int `bson:"notifications,omitempty" json:"notifications"` Email string `bson:"email,omitempty" json:"email,omitempty"` Categories []bson.ObjectId `bson:"categories,omitempty" json:"categories,omitempty"` Facebook interface{} `bson:"facebook,omitempty" json:"facebook,omitempty"` Stats UserStats `bson:"stats,omitempty" json:"stats,omitempty"` ReferralCode string `bson:"ref_code,omitempty" json:"ref_code"` VerificationCode string `bson:"ver_code,omitempty" json:"ver_code"` SessionId string `bson:"-" json:"session_id"` Duplicates []bson.ObjectId `bson:"duplicates" json:"-"` ConfirmationSent *time.Time `bson:"confirm_sent_at" json:"-"` Updated time.Time `bson:"updated_at" json:"updated_at"` Seen *time.Time `bson:"last_seen_at" json:"last_seen_at,omitempty"` Gamificated time.Time `bson:"gamificated_at" json:"gamificated_at"` EmailNotifications bool `bson:"emailNotifications" json:"emailNotifications"` }
func InsertUser ¶
func InsertUser(dal Store, username, password, email string, opts ...Opt) (*UserPrivate, error)
InsertUser creates a new user with the provided username, password, and email. It generates a new user ID, sets the initial user properties, and inserts the user into the database. If the insert fails, it returns an error.
type UserProfileForm ¶
type UserProfileForm struct {
UserName string `json:"username,omitempty"`
}
type UserRecoveryToken ¶
type UserRecoveryToken struct { Id bson.ObjectId `bson:"_id,omitempty" json:"id"` Token string `bson:"token" json:"token"` UserId bson.ObjectId `bson:"user_id" json:"user_id"` Used bool `bson:"used" json:"used"` Created time.Time `bson:"created_at" json:"created_at"` Updated time.Time `bson:"updated_at" json:"updated_at"` }
type UserRegisterForm ¶
type UserSimple ¶
type UserSimple struct { Id bson.ObjectId `bson:"_id,omitempty" json:"id"` Roles []UserRole `bson:"roles" json:"roles,omitempty"` UserName string `bson:"username" json:"username"` UserNameSlug string `bson:"username_slug" json:"username_slug"` Gaming UserGaming `bson:"gaming,omitempty" json:"gaming,omitempty"` Image string `bson:"image" json:"image,omitempty"` Description string `bson:"description" json:"description"` Country string `bson:"country,omitempty" json:"country"` OriginId string `bson:"origin_id,omitempty" json:"origin_id"` BattlenetId string `bson:"battlenet_id,omitempty" json:"battlenet_id"` SteamId string `bson:"steam_id,omitempty" json:"steam_id"` Validated bool `bson:"validated" json:"validated"` Created time.Time `bson:"created_at" json:"created_at"` Seen *time.Time `bson:"last_seen_at" json:"last_seen_at,omitempty"` }
type UserSubscribe ¶
type UserSubscribeForm ¶
type UserToken ¶
type UserToken struct { Id bson.ObjectId `bson:"_id,omitempty" json:"id,omitempty"` UserId bson.ObjectId `bson:"user_id" json:"user_id"` Token string `bson:"token" json:"token"` Closed bool `bson:"closed,omitempty" json"closed,omitempty"` Created time.Time `bson:"created_at" json:"created_at"` Updated time.Time `bson:"updated_at" json:"updated_at"` }
Click to show internal directories.
Click to hide internal directories.