dto

package
v0.0.0-...-4e1abb7 Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2020 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StatusNotCreated = "notCreated"
	StatusCreated    = "created"
	StatusNotUpdated = "notUpdated"
	StatusUpdated    = "updated"
	StatusNotDeleted = "notDeleted"
	StatusDeleted    = "deleted"
	StatusNotFound   = "notFound"
	StatusFound      = "found"
	StatusOk         = "ok"
	StatusFailed     = "failed"

	TypeHealthcheck = "healthcheck"
	TypeSystem      = "system"
)

Variables

This section is empty.

Functions

func AddNewApiErrorResponse

func AddNewApiErrorResponse(name string, response map[string]ApiErrorResponse) error

AddNewApiErrorResponse adds new error api response by name, returns error if already exists

func AddNewApiResponse

func AddNewApiResponse(name string, response map[string]ApiResponse) error

AddNewApiResponse adds new api response by name, returns error if already exists

func AllApiErrorResponses

func AllApiErrorResponses() map[string]map[string]ApiErrorResponse

AllApiErrorResponses returns full map of map ApiErrorResponse structure

func AllApiResponses

func AllApiResponses() map[string]map[string]ApiResponse

AllApiResponses returns full map of map ApiResponse structure

Types

type ApiErrorResponse

type ApiErrorResponse struct {
	Code    int32       `json:"code"`
	Type    string      `json:"type"`
	Message string      `json:"message"`
	Errors  []error     `json:"errors"`
	Data    interface{} `json:"data"`
}

func Failed

func Failed(name string, errors []error) (int, ApiErrorResponse)

func FallbackToFailedError

func FallbackToFailedError(name string, errs []error) (int, ApiErrorResponse)

func NotCreated

func NotCreated(name string, errors []error) (int, ApiErrorResponse)

func NotDeleted

func NotDeleted(name string, errors []error) (int, ApiErrorResponse)

func NotFound

func NotFound(name string, errors []error) (int, ApiErrorResponse)

func NotUpdated

func NotUpdated(name string, errors []error) (int, ApiErrorResponse)

type ApiResponse

type ApiResponse struct {
	Code    int32       `json:"code"`
	Type    string      `json:"type"`
	Message string      `json:"message"`
	Data    interface{} `json:"data"`
	*PaginationContainer
}

func Created

func Created(name string, data interface{}) (int, ApiResponse)

func Deleted

func Deleted(name string, data interface{}) (int, ApiResponse)

func FallbackToFailed

func FallbackToFailed(name string) (int, ApiResponse)

func Found

func Found(name string, data interface{}, pagination interface{}) (int, ApiResponse)

func HealthcheckFound

func HealthcheckFound(data interface{}, pagination interface{}) (int, ApiResponse)

func Ok

func Ok(name string, data interface{}) (int, ApiResponse)

func Updated

func Updated(name string, data interface{}) (int, ApiResponse)

type GeoPoint

type GeoPoint struct {
	Lng float64 `json:"lng" conv:"model"`
	Lat float64 `json:"lat" conv:"model"`
}

type GeoPointStr

type GeoPointStr struct {
	Lng string `json:"lng"`
	Lat string `json:"lat"`
}

type Healthcheck

type Healthcheck struct {
	DB          string    `json:"db"`
	Version     string    `json:"version"`
	RequestedAt time.Time `json:"requested_at"`
}

type Pagination

type Pagination struct {
	Page    int `json:"page"`
	PerPage int `json:"per_page"`
	Total   int `json:"total"`
}

type PaginationContainer

type PaginationContainer struct {
	Pagination Pagination `json:"pagination"`
}

type ResponseHeader

type ResponseHeader struct {
	XRateLimit    int32     `json:"X-Rate-Limit" swagger:"desc(calls per hour allowed by the user)"`
	XExpiresAfter time.Time `json:"X-Expires-After" swagger:"desc(date in UTC when token expires)"`
}

type SearchParams

type SearchParams url.Values

Jump to

Keyboard shortcuts

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