model

package
v0.9.8 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2023 License: Apache-2.0 Imports: 1 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Container

type Container struct {
	Errors   []MessageItem          `json:"errors,omitempty"`
	Data     interface{}            `json:"data,omitempty"`
	Warnings []MessageItem          `json:"warnings,omitempty"`
	Metadata map[string]interface{} `json:"metadata,omitempty"`
	// contains filtered or unexported fields
}

func ErrorResponse

func ErrorResponse(mi MessageItem, statusCode int) *Container

func ListResponse

func ListResponse(data []interface{}) *Container

func Response

func Response(data interface{}) *Container

func ResponseWithStatusCode added in v0.8.2

func ResponseWithStatusCode(data interface{}, statusCode int) *Container

func WithDataOnly added in v0.8.2

func WithDataOnly(data interface{}) *Container

func WithErrorOnly added in v0.8.2

func WithErrorOnly(mi MessageItem, statusCode int) *Container

func (*Container) AddHeader

func (c *Container) AddHeader(key string, value string) *Container

func (*Container) AsJson

func (c *Container) AsJson() *Container

func (*Container) GetHeaders

func (c *Container) GetHeaders() map[string]string

func (*Container) GetStatus

func (c *Container) GetStatus() int

func (*Container) IsDecorated added in v0.8.2

func (c *Container) IsDecorated() bool

type MessageItem

type MessageItem struct {
	Code    string                 `json:"code"`
	Message string                 `json:"message"`
	Details map[string]interface{} `json:"details,omitempty"`
}

Jump to

Keyboard shortcuts

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