domain

package
v0.17.4-rc2 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ContentTypeHeader          = "Content-Type"
	ContentTypeApplicationJSON = "application/json; charset=utf-8"
	ContentTypePlainText       = "text/plain; charset=utf-8"
	ContentTypeJSON            = "json"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type APIError

type APIError struct {
	HTTPStatus int    `json:"-"`
	ErrorCode  string `json:"error_code"`
	Message    string `json:"message"`
	Details    string `json:"details,omitempty"`
}

func NewAPIErrorResponse

func NewAPIErrorResponse(httpStatus int, errorCode, message string, details ...string) *APIError

func (*APIError) Error

func (ae *APIError) Error() string

type CacheConfig added in v0.14.2

type CacheConfig struct {
	Paths map[string]time.Duration
}

type ServiceResponse

type ServiceResponse interface {
	Status() int
	Header() http.Header
	ResponseBytes() ([]byte, error)
	ResponseFormat() string
	Contents() interface{}
}

func NewErrorNotFound

func NewErrorNotFound(errMsg string) ServiceResponse

func NewErrorResponse

func NewErrorResponse(status int, errorCode, errMsg string) ServiceResponse

func NewServiceResponse

func NewServiceResponse(status int, response interface{}) ServiceResponse

func NewServiceResponseWithHeader

func NewServiceResponseWithHeader(status int, response interface{}, header http.Header) ServiceResponse

Jump to

Keyboard shortcuts

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