Documentation ¶
Index ¶
- func CreateUserHandler(connection *sql.DB, cnf config.Config) negroni.HandlerFunc
- func DeleteUserHandler(connection *sql.DB, cnf config.Config) negroni.HandlerFunc
- func GetUsernamesHandler(connection *sql.DB) negroni.HandlerFunc
- func UpdateUserHandler(connection *sql.DB, cnf config.Config) negroni.HandlerFunc
- func UserByIndexHandler(connection *sql.DB) negroni.HandlerFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateUserHandler ¶
CreateUserHandler creates a new user in the database. Password is saved as a hash.
func DeleteUserHandler ¶
DeleteUserHandler removes a user from the database. User can only deletes it's own record.
func GetUsernamesHandler ¶
func GetUsernamesHandler(connection *sql.DB) negroni.HandlerFunc
GetUsernamesHandler is a handler for collecting usernames coresponding to user ID's. The request expects a json object in the following format: { "requests":[{"id":1} ,{"id":2},{"id":3}, {"id":4} ]}.
func UpdateUserHandler ¶
UpdateUserHandler updates an user based on it's user ID. User is only allowed to update it's own record. Verification is being done based on the JWT in the request.
func UserByIndexHandler ¶
func UserByIndexHandler(connection *sql.DB) negroni.HandlerFunc
UserByIndexHandler retrieves an user from the database based on its id. This handler expects the id being passed in the route variable in the current request.
Types ¶
This section is empty.