util

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2022 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrEmptyBody = errors.New("body must not be empty")

Functions

func DecodeJson

func DecodeJson(body io.Reader, o interface{}) error

func EncodeJson

func EncodeJson(w io.Writer, err error) error

func EncodeJsonStatus

func EncodeJsonStatus(w io.Writer, message string, statusCode int, o interface{}) error

Types

type QueueError

type QueueError struct {
	Err error
	// contains filtered or unexported fields
}

func (*QueueError) Delay

func (e *QueueError) Delay() time.Duration

func (*QueueError) Error

func (e *QueueError) Error() string

type QueueName

type QueueName string
const DeleteEntityQueue QueueName = "delete_entity_queue"

type RateLimitError

type RateLimitError struct {
	Err error
	// contains filtered or unexported fields
}

func (*RateLimitError) Delay

func (e *RateLimitError) Delay() time.Duration

func (*RateLimitError) Error

func (e *RateLimitError) Error() string

type Response

type Response struct {
	StatusCode int `json:"-"`
}

func (Response) Render

func (res Response) Render(w http.ResponseWriter, r *http.Request) error

type ServerResponse

type ServerResponse struct {
	Response
	Status  bool            `json:"status"`
	Message string          `json:"message"`
	Data    json.RawMessage `json:"data,omitempty"`
}

func NewErrorResponse

func NewErrorResponse(msg string, statusCode int) ServerResponse

func NewServerResponse

func NewServerResponse(msg string, object interface{}, statusCode int) ServerResponse

func NewServiceErrResponse

func NewServiceErrResponse(err error) ServerResponse

type ServiceError

type ServiceError struct {
	// contains filtered or unexported fields
}

func NewServiceError

func NewServiceError(errCode int, errMsg error) *ServiceError

func (*ServiceError) ErrCode

func (s *ServiceError) ErrCode() int

func (*ServiceError) Error

func (s *ServiceError) Error() string

type TaskName

type TaskName string
const DeleteEntityTask TaskName = "DeleteEntityTask"

Jump to

Keyboard shortcuts

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