Documentation ¶
Index ¶
- type Controller
- func (c *Controller) GetUserAfterLogin(username string) (*datatypes.User, error)
- func (c *Controller) OpenConnection() (error, bool)
- func (c *Controller) PasswordMatches(user, pw string) (error, bool)
- func (c *Controller) SaveNewUser(name, pw string) (error, bool)
- func (c *Controller) UserExists(name string) (error, bool)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Controller ¶
type Controller struct {
// contains filtered or unexported fields
}
Database controller struct holding database name database username and passwor port for database gets loaded on program startup from .env file
func NewController ¶
func NewController(name, username, pw string, port int) *Controller
Create new database controller
func (*Controller) GetUserAfterLogin ¶
func (c *Controller) GetUserAfterLogin(username string) (*datatypes.User, error)
fetch user by username from database returns pointer to user or error on failure
func (*Controller) OpenConnection ¶
func (c *Controller) OpenConnection() (error, bool)
Open gorm database connection for accessing information Uses environment variables from controller creation returns nil, true on success, err, false otherwise
func (*Controller) PasswordMatches ¶
func (c *Controller) PasswordMatches(user, pw string) (error, bool)
Check if password for user exists and matches the saved hash
func (*Controller) SaveNewUser ¶
func (c *Controller) SaveNewUser(name, pw string) (error, bool)
Saves a user with password converts password to hash with custom salt
func (*Controller) UserExists ¶
func (c *Controller) UserExists(name string) (error, bool)
check if user exists
Click to show internal directories.
Click to hide internal directories.