Documentation
¶
Index ¶
Constants ¶
View Source
const BadRequest = 400
Variables ¶
View Source
var ErrorCode int // http-status code for errors
Functions ¶
func ReadUserIDByToken ¶
func ReadUserIDByToken(tgtToken string, fieldErr *fields.GrammarError) int
returns the user id asscoiated by the auth-token
Types ¶
type Account ¶
type Account struct { ID int `json:"id" form:"id"` Fname string `json:"fname" form:"fname"` Lname string `json:"lname" form:"lname"` Address string `json:"address" form:"address"` Username string `json:"username" form:"username"` Password string `json:"password" form:"password"` }
meant to be binded to new acct info
type AuthError ¶
type AuthError struct {
ErrMsgs []string
}
meant to hold err strings related to authentication and account creation
type LoginStatus ¶
type Passwords ¶
type Passwords struct { ID int `db:"id" json:"id" form:"id"` UserID int `db:"user_id" json:"user_id" form:"user_id"` Password []byte `db:"password" json:"password" form:"password"` }
func ReadHashByID ¶
func ReadHashByID(userID int) ([]*Passwords, fields.GrammarError)
returns a pswd hash given userid if the id doesn't exist it error
type Registered ¶
func AddAccount ¶
func AddAccount(acct *Account) (*Registered, fields.GrammarError)
adds the account info to the appropiate tables w/ the database
type Tokens ¶
type Tokens struct { ID int `db:"id" json:"id" form:"id"` UserID int `db:"user_id" json:"user_id"` Token []byte `db:"token" json:"token"` }
func GenerateToken ¶
func GenerateToken(username string, acctErr *fields.GrammarError) Tokens
creates an auth-token for a user and stores it in the database
type UserContacts ¶
type UserContacts struct { ID int `db:"id" json:"id"` UserID int `db:"user_id" json:"user_id"` Fname string `db:"fname" json:"fname" form:"fname"` Lname string `db:"lname" json:"lname" form:"lname"` Address string `db:"address" json:"address"` }
func ReadUserContact ¶
func ReadUserContact() ([]*UserContacts, fields.GrammarError)
returns the list of all existing users
func ReadUserContactByID ¶
func ReadUserContactByID(id int) ([]*UserContacts, fields.GrammarError)
returns a user given the id if the id doesn't exist it error
type Usernames ¶
type Usernames struct { ID int `db:"id" json:"id"` Username string `db:"username" json:"username"` }
func DeleteAcct ¶
func DeleteAcct(user Usernames) ([]*Usernames, fields.GrammarError)
Deletes the User account which cascades to delete their invoices too
func ReadUsernameByID ¶
func ReadUsernameByID(userID int, fieldErr *fields.GrammarError) []*Usernames
Click to show internal directories.
Click to hide internal directories.