db

package
v0.0.0-...-1bb48b5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 27, 2023 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetMessagesForUser

func GetMessagesForUser(user string) []string

GetMessagesForUser assumes that a user has already been authenticated through a call to session.Authenticate(user) and then returns all the messages stored for that user

func GetUserId

func GetUserId(user string) (int, error)

GetUserId will return the UserId number for the user 'user' if that user exists and an error otherwise

func GetUserPassHash

func GetUserPassHash(user string) (string, error)

GetUserPassHash will return the string representation of a password hash if the user exists and an error otherwise

func NoUsers

func NoUsers() bool

Returns true if no users have been registered and false otherwise

func SaveMessage

func SaveMessage(message, recipient string)

saveMessage will process the transaction to place a message into the database

func SetUserPassHash

func SetUserPassHash(user, hash string) error

SetUsePassHash will allow for adding a new user to the Users table

func UserExists

func UserExists(user string) bool

UserExists takes a username 'user' and returns true if that user exists and false otherwise

Types

type Database

type Database struct {
	Db *sql.DB
}

func Connect

func Connect() *Database

type ErrNoUser

type ErrNoUser struct{}

ErrNoUser is a generic error for no user existing

func (*ErrNoUser) Error

func (e *ErrNoUser) Error() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL