response

package
v0.0.4 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const LogType = "response"

Variables

This section is empty.

Functions

This section is empty.

Types

type DataResponse

type DataResponse struct {
	Data any `json:"data"`
}

func NewDataResponse

func NewDataResponse(data any) DataResponse

type ErrorResponse

type ErrorResponse struct {
	Error error `json:"error"`
}

func NewErrorResponse

func NewErrorResponse(err error) ErrorResponse

type LoggableData added in v0.0.4

type LoggableData struct {
	Date  time.Time `json:"date"`
	ReqID string    `json:"requestID,omitempty"`
	Type  string    `json:"type"`
	DataResponse
}

func (*LoggableData) RequestID added in v0.0.4

func (r *LoggableData) RequestID() string

func (*LoggableData) SetRequestID added in v0.0.4

func (r *LoggableData) SetRequestID(id string)

type Responder

type Responder interface {
	Respond(w io.Writer, dataOrErr any)
}

Responder - response service interface

type Response

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

Response - response service

func NewResponseService

func NewResponseService(logger logger.Logger) *Response

func (*Response) Respond

func (r *Response) Respond(w io.Writer, dataOrErr any)

Jump to

Keyboard shortcuts

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