Documentation ¶
Index ¶
- type DB
- type Quote
- type QuoteManager
- type User
- type UserManager
- func (state *UserManager) AddUser(username, password string) *User
- func (state *UserManager) CheckPassword(hashedPassword, password string) bool
- func (state *UserManager) FindUser(username string) *User
- func (state *UserManager) FindUserByUUID(uuid string) *User
- func (state *UserManager) HasUser(username string) bool
- func (state *UserManager) HashPassword(username, password string) string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type QuoteManager ¶
type QuoteManager struct {
// contains filtered or unexported fields
}
QuoteManager struct
func NewQuoteManager ¶
func NewQuoteManager(db *DB) (*QuoteManager, error)
NewQuoteManager - Create a quote manager that can be used for retrieving quotes
func (*QuoteManager) RandomQuote ¶
func (qm *QuoteManager) RandomQuote() *Quote
RandomQuote - return a random quote
type User ¶
type User struct { gorm.Model `json:"-"` Username string `gorm:"not null;unique" json:"username"` Password string `gorm:"not null" json:"-"` UUID string `gorm:"not null;unique" json:"uuid"` }
User struct
type UserManager ¶
type UserManager struct {
// contains filtered or unexported fields
}
UserManager struct
func NewUserManager ¶
func NewUserManager(db *DB) (*UserManager, error)
NewUserManager - Create a new *UserManager that can be used for managing users.
func (*UserManager) AddUser ¶
func (state *UserManager) AddUser(username, password string) *User
AddUser - Creates a user and hashes the password
func (*UserManager) CheckPassword ¶
func (state *UserManager) CheckPassword(hashedPassword, password string) bool
CheckPassword - compare a hashed password with a possible plaintext equivalent
func (*UserManager) FindUserByUUID ¶
func (state *UserManager) FindUserByUUID(uuid string) *User
FindUserByUUID -
func (*UserManager) HasUser ¶
func (state *UserManager) HasUser(username string) bool
HasUser - Check if the given username exists.
func (*UserManager) HashPassword ¶
func (state *UserManager) HashPassword(username, password string) string
HashPassword - Hash the password (takes a username as well, it can be used for salting).
Click to show internal directories.
Click to hide internal directories.