response

package
v1.1.3-alpha.9 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2022 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Assembler

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

Assembler is to marshal records

func New

func New(collection *meta.Collection, resourceLocation string) *Assembler

New creates a new Assembler that marshals records

func (*Assembler) HTMLError

func (m *Assembler) HTMLError(error *errors.Error) (int, []byte)

HTMLError renders the error into HTML format and writes it into c

func (*Assembler) HTMLResponse

func (m *Assembler) HTMLResponse(c echo.Context, response *MatrixResponse) error

HTMLResponse renders the response into HTML format and writes it into c

func (*Assembler) JSONError

func (m *Assembler) JSONError(error *errors.Error) (int, interface{})

JSONError renders the error into JSON format and writes it into c

func (*Assembler) JSONMatrixResponse added in v1.1.0

func (m *Assembler) JSONMatrixResponse(c echo.Context, response *MatrixResponse) error

JSONMatrixResponse renders the response into JSON format and writes it into c

func (*Assembler) MarshalMatrix added in v1.1.0

func (m *Assembler) MarshalMatrix(records []*matrix.Matrix, query *matrix.Query) *MatrixResponse

MarshalMatrix marshals records with their dependencies and gives MatrixResponse that contains rich metadata for current state of controllers

func (*Assembler) MarshalSiteStats added in v1.1.0

func (m *Assembler) MarshalSiteStats(records []siteStats.StageTime, query *siteStats.Query) *SiteStatsResponse

MarshalSiteStats marshals records with their dependencies and gives MatrixResponse that contains rich metadata for current state of controllers

type MatrixResponse

type MatrixResponse struct {
	Request *RequestMetadata `json:"request,omitempty"`
	Query   *matrix.Query    `json:"query,omitempty"`

	// CacheStatus represents statuses of underlying controllers and caches of current response
	CacheStatus map[string]*status.Status `json:"cache,omitempty"`

	Items  []*item.Item     `json:"items,omitempty"`
	Matrix []*matrix.Matrix `json:"matrix,omitempty"`
	Stages []*stage.Stage   `json:"stages,omitempty"`
	Zones  []*zone.Zone     `json:"zones,omitempty"`
}

MatrixResponse consists additional data from the matrix result itself

func NewMatrixResponse added in v1.1.0

func NewMatrixResponse() *MatrixResponse

NewMatrixResponse creates a new MatrixResponse

type RequestMetadata

type RequestMetadata struct {
	// Mirror is the preferred mirror to select from; oftenly chose with reference of `CF-IPCountry` header
	Mirror string `json:"mirror,omitempty"`
}

RequestMetadata describes metadata related to the subsequent request

type SiteStatsResponse added in v1.1.0

type SiteStatsResponse struct {
	Query *siteStats.Query `json:"query,omitempty"`

	// CacheStatus represents statuses of underlying controllers and caches of current response
	CacheStatus map[string]*status.Status `json:"cache,omitempty"`

	Stats []*siteStats.SiteStat `json:"stats,omitempty"`
}

SiteStatsResponse consists additional data from the site stats result itself

Jump to

Keyboard shortcuts

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