Documentation ¶
Index ¶
- Variables
- func ChangeUserBalance(username string, change int) (int, error)
- func CheckIfUsernameTaken(username string) bool
- func Connect()
- func Disconnect()
- func NewUser(username string, passwordHash string) error
- func Ping(ctx context.Context) error
- func RemoveUser(username string) error
- func RevokeSession(sessionToken string) error
- type SessionIdentity
- type User
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrThereIsNoSessionTokenForThatUser = errors.New("There is no session token for that user") ErrThereIsNoSessionIdentityForThatSessionToken = errors.New("There is no session identity for that session token") )
View Source
var ErrUserDoesNotExist = errors.New("User does not exist")
View Source
var ErrUsernameTaken = errors.New("Username taken")
Functions ¶
func CheckIfUsernameTaken ¶
func Disconnect ¶
func Disconnect()
func RemoveUser ¶
func RevokeSession ¶
RevokeSession removes the SessionIdentity (in the db) that contains the provided session token
Types ¶
type SessionIdentity ¶
type SessionIdentity struct { ID primitive.ObjectID `bson:"_id,omitempty"` Username string `bson:"username,omitempty"` SessionToken string `bson:"sessionToken,omitempty"` ExpirationDate int64 `bson:"expirationDate,omitempty"` }
func CreateNewSession ¶
func CreateNewSession(username string, sessionToken string) (SessionIdentity, error)
func FindSessionIdentityFromSessionToken ¶
func FindSessionIdentityFromSessionToken(sessionToken string) (SessionIdentity, error)
Click to show internal directories.
Click to hide internal directories.