serializer

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: May 23, 2018 License: GPL-3.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HTTPError

type HTTPError interface {
	error
	StatusCode() int
}

HTTPError defines an Error message as it will be written in the http.Response

func NewHTTPError

func NewHTTPError(statusCode int, msg ...string) HTTPError

NewHTTPError returns an Error

func NewMySQLError

func NewMySQLError(statusCode int, mysqlCode uint16, msg ...string) HTTPError

NewHTTPError returns an Error with the MySQL error code

type Response

type Response struct {
	Status int         `json:"status"`
	Data   interface{} `json:"data,omitempty"`
	Meta   interface{} `json:"meta,omitempty"`
	Errors []HTTPError `json:"errors,omitempty"`
}

Response encapsulate the content of an http.Response

func NewEmptyResponse

func NewEmptyResponse() *Response

NewEmptyResponse returns an empty Response

func NewQueryResponse

func NewQueryResponse(rows []map[string]interface{}, columnNames, columnTypes []string) *Response

NewQueryResponse returns a Response with table headers and row contents

func NewVersionResponse

func NewVersionResponse(version string) *Response

NewVersionResponse returns a Response with current version of the server

Jump to

Keyboard shortcuts

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