Documentation ¶
Index ¶
- type DBStore
- func (s *DBStore) AddFollower(ctx context.Context, targetUser, follower uint) error
- func (s *DBStore) Disconnect()
- func (s *DBStore) Get(ctx context.Context, username string) (*entity.User, error)
- func (s *DBStore) GetByUUID(ctx context.Context, uuid string) (*entity.User, error)
- func (s *DBStore) GetFollows(ctx context.Context, uid uint) ([]*entity.User, error)
- func (s *DBStore) New(ctx context.Context, u *entity.User) error
- func (s *DBStore) RemoveFollower(ctx context.Context, targetUser, follower uint) error
- func (s *DBStore) SetPassword(ctx context.Context, uuid string, hashpass string) error
- func (s *DBStore) SetRating(ctx context.Context, uuid string, variant entity.VariantKey, ...) error
- func (s *DBStore) SetStats(ctx context.Context, uuid string, variant entity.VariantKey, ...) error
- func (s *DBStore) Username(ctx context.Context, uuid string) (string, error)
- type RedisPresenceStore
- type User
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DBStore ¶
type DBStore struct {
// contains filtered or unexported fields
}
DBStore is a postgres-backed store for users.
func (*DBStore) AddFollower ¶
AddFollower creates a follower -> target follow.
func (*DBStore) Disconnect ¶
func (s *DBStore) Disconnect()
func (*DBStore) GetFollows ¶
GetFollows gets all the users that the passed-in user DB ID is following.
func (*DBStore) RemoveFollower ¶
RemoveFollower removes a follower -> target follow.
func (*DBStore) SetPassword ¶
SetPassword sets the password for the user. The password is already hashed.
func (*DBStore) SetRating ¶
func (s *DBStore) SetRating(ctx context.Context, uuid string, variant entity.VariantKey, rating entity.SingleRating) error
SetRating sets the specific rating for the given variant.
type RedisPresenceStore ¶
type RedisPresenceStore struct { }
RedisPresenceStore implements a Redis store for user presence.
func (*RedisPresenceStore) SetPresence ¶
func (s *RedisPresenceStore) SetPresence(ctx context.Context, uuid, channel string) error
SetPresence sets the user's channel. If blank, this means the user is offline.
type User ¶
type User struct { gorm.Model UUID string `gorm:"type:varchar(24);index"` Username string `gorm:"type:varchar(32);unique_index"` Email string `gorm:"type:varchar(100);unique_index"` // Password will be hashed. Password string `gorm:"type:varchar(128)"` }
User should be a minimal object. All information such as user profile, awards, ratings, records, etc should be in a profile object that joins 1-1 with this User object. User is exported as a Game has Foreign Keys to it.