Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func HashPassword ¶
HashPassword encrypts a password so it can be stored safely
func VerifyPassword ¶
VerifyPassword decrypts and checks if a hashed password is the same as the given string
Types ¶
type ChatroomDB ¶
ChatroomDB allows the app to neatly interface with GORM
func NewChatroomDB ¶
NewChatroomDB instantiates a new ChatroomDB object
func (*ChatroomDB) Migrate ¶
func (c *ChatroomDB) Migrate() error
Migrate runs the migrations on the GORM models
type User ¶
type User struct { gorm.Model ID string `gorm:"primary_key"` Username string `gorm:"not null;unique" json:"username"` Email string `gorm:"not null;unique" json:"email"` Password string `gorm:"not null;" json:"password"` }
User is an entity that can log in our system
func (*User) BeforeSave ¶
BeforeSave is a GORM hook that encrypts the password before saving it
Click to show internal directories.
Click to hide internal directories.