Documentation ¶
Index ¶
- func CheckTokenMatch(db *gorm.DB, userId int64, token string) bool
- func CheckUnique(db *gorm.DB, column string, value any, tableName string) bool
- func GenerateCode() (int, error)
- func GenerateToken() string
- func GetUserFromToken(db *gorm.DB, token string) (handlers.User, error)
- func IsEmailValid(email string) (bool, error)
- func RespondError(w http.ResponseWriter, message any, status int)
- func RespondJSON(w http.ResponseWriter, status int, message string)
- func UsersExist(userIds []int64, db *gorm.DB) bool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckTokenMatch ¶
CheckTokenMatch checks if a token and a userId match
func CheckUnique ¶
CheckUnique checks if any value is unique in a table
func GetUserFromToken ¶
GetUserFromToken returns the user associated with the given token
func IsEmailValid ¶
func RespondError ¶
func RespondError(w http.ResponseWriter, message any, status int)
RespondError returns an error message as response
func RespondJSON ¶
func RespondJSON(w http.ResponseWriter, status int, message string)
RespondJSON function to return JSON message as response (mainly used on success)
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.