user

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

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

Go to latest
Published: Jan 22, 2018 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TOKEN_CHANGE_EMAIL    = "change_email"
	TOKEN_ACTIVATE        = "activate"
	TOKEN_PASSWORD_CHANGE = "password"
)

Variables

This section is empty.

Functions

func ActivateUser

func ActivateUser(userId string) bool

func ConvertUserToMap

func ConvertUserToMap(u *entities.User) map[string]interface{}

func CreateUser

func CreateUser(details map[string]interface{}) (entities.User, error)

func FindUserBy

func FindUserBy(key string, value string) (entities.User, bool)

Fetches the user from the database by the provided key. First return value is a user itself. Second return value is OK/found

func GenerateUserToken

func GenerateUserToken(tokenType string, user entities.User, value string) (string, bool)

func GetCountryCodeByIP

func GetCountryCodeByIP(ipAddress string) (string, bool)

func GetCountryCodeByName

func GetCountryCodeByName(name string) (string, bool)

func GetGameResultsForUser

func GetGameResultsForUser(offset int, filters map[string]interface{}) ([]map[string]interface{}, bool)

func GetUser

func GetUser(id string) (entities.User, bool)

func GetUserToken

func GetUserToken(token string, tokenType string) (entities.UserToken, bool)

func IsEmailAvailable

func IsEmailAvailable(email string) bool

Checks if there's already an account with provided e-mail address

func IsUsernameAvailable

func IsUsernameAvailable(username string) bool

Checks if account with provided username already exists

func RemoveTokensForUser

func RemoveTokensForUser(tokenType string, userId string)

func SanitizeUser

func SanitizeUser(user *entities.User)

func SearchForUsers

func SearchForUsers(query string) []map[string]interface{}

Returns an array of usernames for a given search keyword

func UpdateUser

func UpdateUser(user *entities.User) bool

func UpdateUserPassword

func UpdateUserPassword(password string, user entities.User) bool

func UseUserToken

func UseUserToken(token string, tokenType string) bool

func UserExists

func UserExists(id string) bool

func ValidateCountryCode

func ValidateCountryCode(code string) (string, bool)

func ValidateEmail

func ValidateEmail(email string) (bool, string)

func ValidateName

func ValidateName(name string) (bool, string)

func ValidatePassword

func ValidatePassword(password string) (bool, string)

func ValidateUser

func ValidateUser(details map[string]interface{}) (bool, map[string]string)

func ValidateUsername

func ValidateUsername(username string) (bool, string)

Types

This section is empty.

Jump to

Keyboard shortcuts

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