Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Create ¶
@Summary Add new user to the database @Description Add a new user @Tags user @Accept json @Produce json @Param user body user.CreateRequest true "Create a new user" @Success 200 {object} user.CreateResponse "{"code":0,"message":"OK","data":{"username":"kong"}}" @Router /user [post]
func Delete ¶
@Summary Delete an user by the user identifier @Description Delete user by ID @Tags user @Accept json @Produce json @Param id path uint64 true "The user's database id index num" @Success 200 {object} handler.Response "{"code":0,"message":"OK","data":null}" @Router /user/{id} [delete]
func Get ¶
@Summary Get an user by the user identifier @Description Get an user by username @Tags user @Accept json @Produce json @Param username path string true "Username" @Success 200 {object} model.UserModel "{"code":0,"message":"OK","data":{"username":"kong","password":"$2a$10$E0kwtmtLZbwW/bDQ8qI8e.eHPqhQOW9tvjwpyo/p05f/f4Qvr3OmS"}}" @Router /user/{username} [get]
func List ¶
@Summary List the users in the database @Description List users @Tags user @Accept json @Produce json @Param user body user.ListRequest true "List users" @Success 200 {object} user.SwaggerListResponse "{"code":0,"message":"OK","data":{"totalCount":1,"userList":[{"id":0,"username":"admin","random":"user 'admin' get random string 'EnqntiSig'","password":"$2a$10$veGcArz47VGj7l9xN7g2iuT9TF21jLI1YGXarGzvARNdnt4inC9PG","createdAt":"2018-05-28 00:25:33","updatedAt":"2018-05-28 00:25:33"}]}}" @Router /user [get]
func Login ¶
@Summary Login generates the authentication token @Produce json @Param username body string true "Username" @Param password body string true "Password" @Success 200 {string} json "{"code":0,"message":"OK","data":{"token":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE1MjgwMTY5MjIsImlkIjowLCJuYmYiOjE1MjgwMTY5MjIsInVzZXJuYW1lIjoiYWRtaW4ifQ.LjxrK9DuAwAzUD8-9v43NzWBN7HXsSLfebw92DKd1JQ"}}" @Router /login [post]
func Update ¶
@Summary Update a user info by the user identifier @Description Update a user by ID @Tags user @Accept json @Produce json @Param id path uint64 true "The user's database id index num" @Param user body model.UserModel true "The user info" @Success 200 {object} handler.Response "{"code":0,"message":"OK","data":null}" @Router /user/{id} [put]
Types ¶
type CreateRequest ¶
type CreateResponse ¶
type CreateResponse struct {
Username string `json:"username"`
}