users

package
v0.0.0-...-1276dd2 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2017 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package users ...

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Entity

type Entity struct {
	ID       uint64        `json:"id" xorm:"'id' pk index autoincr"`
	Created  uint64        `json:"created" xorm:"'created'"`
	Updated  uint64        `json:"updated" xorm:"'updated'"`
	Login    string        `json:"login" xorm:"index unique"`
	Email    string        `json:"email" xorm:"'email'"`
	Password string        `json:"-"`
	GroupID  uint64        `json:"group_id" xorm:"'group_id' index"`
	Group    groups.Entity `json:"group" xorm:"-"`
}

Entity represents user

func FindByParams

func FindByParams(orm *xorm.Engine, params *getUsersParams) ([]Entity, error)

FindByParams users in database

func (*Entity) Delete

func (e *Entity) Delete(orm *xorm.Engine) error

Delete user from database

func (*Entity) ExtractFrom

func (e *Entity) ExtractFrom(orm *xorm.Engine) error

ExtractFrom extracts user from database

func (*Entity) Save

func (e *Entity) Save(orm *xorm.Engine) error

Save user to database

func (*Entity) TableName

func (e *Entity) TableName() string

TableName used by xorm to set table name for entity

func (*Entity) Update

func (e *Entity) Update(orm *xorm.Engine) error

Update user in database

type Handler

type Handler struct {
	C *ctx.Context
}

Handler is a container for handlers and app data

func (*Handler) CreateUser

func (h *Handler) CreateUser(c echo.Context) error

CreateUser is a POST /users handler swagger:operation POST /users users CreateUser

Create new user and save it in storage

--- responses:

201:
  description: return created user
  schema:
    $ref: '#/definitions/UserEntity'

func (*Handler) DeleteUser

func (h *Handler) DeleteUser(c echo.Context) error

DeleteUser is a DELETE /users/{ID} handler swagger:operation DELETE /users/{ID} users DeleteUser

Delete user by ID

--- responses:

204:
  description: OK
400:
  $ref: '#/responses/badRequest'

func (*Handler) GetUsers

func (h *Handler) GetUsers(c echo.Context) error

GetUsers is a GET /users handler swagger:operation GET /users users GetUsers

Returns users list

--- responses:

200:
  description: returns array of users
  schema:
    type: array
    items:
      $ref: '#/definitions/UserEntity'

func (*Handler) PutUser

func (h *Handler) PutUser(c echo.Context) error

PutUser is a PUT /users/{ID} handler swagger:operation PUT /users/{ID} users PutUser

Update user by ID and save user in the storage

--- responses:

200:
  description: return updated user
  schema:
    $ref: '#/definitions/UserEntity'

type UserInput

type UserInput struct {
	Login         string `json:"login"`
	Password      string `json:"password"`
	Email         string `json:"email"`
	PasswordEtime uint64 `json:"password_etime"`
	GroupID       uint64 `json:"group_id"`
}

UserInput represents payload data format

Jump to

Keyboard shortcuts

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