model

package
v0.0.0-...-16335c8 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2017 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthRequest

type AuthRequest struct {
	ID       string `json:"id"`
	Password string `json:"password"`
}

AuthRequest represents a request for authenticate user

type AuthResponse

type AuthResponse struct {
	Message string `json:"message"`
	Token   string `json:"token"`
}

AuthResponse is a response type returned from AuthHandler

type CreateUserRequest

type CreateUserRequest struct {
	ID       string `json:"id"`
	Username string `json:"username"`
	Password string `json:"password"`
}

CreateUserRequest represents a request for create user

type CreateUserResponse

type CreateUserResponse struct {
	Message string `json:"message"`
}

CreateUserResponse is a response type returned from CreateUserHandler

type DeleteUserRequest

type DeleteUserRequest struct {
	ID       string `json:"id"`
	Password string `json:"password"`
}

DeleteUserRequest represents a request for delete user

type DeleteUserResponse

type DeleteUserResponse struct {
	Message string `json:"message"`
}

DeleteUserResponse is a response type returned from DeleteUserHandler

type ErrorResponse

type ErrorResponse struct {
	Message string `json:"message"`
	Error   string `json:"error,omitempty"`
}

ErrorResponse is a response type returned when HTTP error is raised

type GetAlgorithmResponse

type GetAlgorithmResponse struct {
	Algorithm string `json:"algorithm"`
}

GetAlgorithmResponse is a response type returned from GetAlgorithmHandler

type GetKeyResponse

type GetKeyResponse struct {
	PublicKey string `json:"publickey"`
}

GetKeyResponse is a response type returned from GetKeyHandler

type HealthCheckResponse

type HealthCheckResponse struct {
	Message string `json:"message"`
}

HealthCheckResponse is a response type returned from HealthCheckHandler

type ListupUserResponse

type ListupUserResponse struct {
	Users UserList `json:"user"`
}

ListupUserResponse is a response type returned from ListupUserHandler

type LookupUserRequest

type LookupUserRequest struct {
	ID string `json:"id"`
}

LookupUserRequest represents a request for read user

type LookupUserResponse

type LookupUserResponse struct {
	User User `json:"user"`
}

LookupUserResponse is a response type returned from LookupUserHandler

type UpdateUserRequest

type UpdateUserRequest struct {
	ID          string `json:"id"`
	Username    string `json:"username"`
	OldPassword string `json:"old_password"`
	NewPassword string `json:"new_password"`
}

UpdateUserRequest represents a request for update upser

type UpdateUserResponse

type UpdateUserResponse struct {
	Message string `json:"message"`
}

UpdateUserResponse is a resposne type returned from UpdateUserHandler

type User

type User struct {
	ID       string `json:"id"`
	Name     string `json:"username"`
	Password string `json:"password,omitempty"`
	IsAdmin  bool   `json:"is_admin"`
}

User represents an user

func (*User) FromDB

func (u *User) FromDB(du *db.User) error

FromDB binds db.User to model.User

func (*User) Load

func (u *User) Load(tx *sql.Tx, id string) (err error)

Load with user ID

func (*User) ToDB

func (u *User) ToDB(du *db.User) error

ToDB binds model.User to db.User

type UserList

type UserList []User

UserList type

func (UserList) Len

func (ul UserList) Len() int

Len returns the number of elements

func (UserList) Less

func (ul UserList) Less(i, j int) bool

Less for sort

func (UserList) Swap

func (ul UserList) Swap(i, j int)

Swap two elements

type VerifyResponse

type VerifyResponse struct {
	Status bool `json:"status"`
}

VerifyResponse is a response type returned from VerifyHandler

Jump to

Keyboard shortcuts

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