res

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2019 License: GPL-2.0 Imports: 6 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Response

type Response struct {
	Function string
	Code     int
	Payload  struct {
		Success  bool        `json:"success"`
		Error    *string     `json:"error,omitempty"`
		Token    *string     `json:"token,omitempty"`
		User     interface{} `json:"user,omitempty"`
		UserList interface{} `json:"userList,omitempty"`
	}
	InternalError *ServerError
}

func New

func New(code int) *Response

func (*Response) Error

func (r *Response) Error(w http.ResponseWriter)

func (*Response) JSON

func (r *Response) JSON(w http.ResponseWriter)

func (*Response) SetErrorMessage

func (r *Response) SetErrorMessage(message string) *Response

func (*Response) SetInternalError

func (r *Response) SetInternalError(serverError *ServerError) *Response

func (*Response) SetToken

func (r *Response) SetToken(token string) *Response

func (*Response) SetUser

func (r *Response) SetUser(data interface{}) *Response

func (*Response) SetUsers

func (r *Response) SetUsers(datas interface{}) *Response

type ServerError

type ServerError struct {
	Err   error
	Args  []interface{}
	Query string
}

func CreateInternalError

func CreateInternalError(query string, args []interface{}, err error) *ServerError

Jump to

Keyboard shortcuts

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