transformer

package
v1.43.1 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

New returns a new instance of Transformer ES7x

func NewReleaseTransformer

func NewReleaseTransformer() api.ReleaseResponseTransformer

Types

type Breakdown

type Breakdown struct {
	Total       int `json:"total"`
	Provisional int `json:"provisional,omitempty"`
	Confirmed   int `json:"confirmed,omitempty"`
	Postponed   int `json:"postponed,omitempty"`
	Published   int `json:"published,omitempty"`
	Cancelled   int `json:"cancelled,omitempty"`
	Census      int `json:"census,omitempty"`
}

type ESReleaseHighlight

type ESReleaseHighlight struct {
	Title    []string `json:"title"`
	Summary  []string `json:"summary"`
	Keywords []string `json:"keywords"`
}

type ESReleaseResponse

type ESReleaseResponse struct {
	Responses []ESReleaseResponseItem `json:"responses"`
}

type ESReleaseResponseAggregations

type ESReleaseResponseAggregations map[aggName]aggregation

type ESReleaseResponseHit

type ESReleaseResponseHit struct {
	Source    ESReleaseSourceDocument `json:"_source"`
	Highlight ESReleaseHighlight      `json:"highlight"`
}

type ESReleaseResponseItem

type ESReleaseResponseItem struct {
	Took         int                           `json:"took"`
	TimedOut     bool                          `json:"timed_out"`
	Hits         ESReleaseResponseSummary      `json:"hits"`
	Aggregations ESReleaseResponseAggregations `json:"aggregations"`
}

type ESReleaseResponseSummary

type ESReleaseResponseSummary struct {
	Total struct {
		Value int `json:"value"`
	} `json:"total"`
	Hits []ESReleaseResponseHit `json:"hits"`
}

type ESReleaseSourceDocument

type ESReleaseSourceDocument struct {
	URI         string       `json:"uri"`
	Title       string       `json:"title"`
	Summary     string       `json:"summary"`
	ReleaseDate string       `json:"release_date,omitempty"`
	Published   bool         `json:"published"`
	Cancelled   bool         `json:"cancelled"`
	Finalised   bool         `json:"finalised"`
	Survey      string       `json:"survey"`
	Keywords    []string     `json:"keywords,omitempty"`
	Language    string       `json:"language,omitempty"`
	DateChanges []dateChange `json:"date_changes,omitempty"`
}

type LegacyTransformer

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

LegacyTransformer represents an instance of the ResponseTransformer interface

func (*LegacyTransformer) TransformCountResponse added in v1.32.0

func (t *LegacyTransformer) TransformCountResponse(_ context.Context, _ []byte) (int, error)

TransformCountResponse is not supported for legacy transformer.

func (*LegacyTransformer) TransformSearchResponse

func (t *LegacyTransformer) TransformSearchResponse(_ context.Context, responseData []byte, query string, highlight bool) ([]byte, error)

TransformSearchResponse transforms an elastic search response into a structure that matches the v1 api specification

type Release

type Release struct {
	URI         string              `json:"uri"`
	DateChanges []ReleaseDateChange `json:"date_changes"`
	Description ReleaseDescription  `json:"description"`
	Highlight   *highlight          `json:"highlight,omitempty"`
}

type ReleaseDateChange

type ReleaseDateChange struct {
	ChangeNotice string `json:"change_notice"`
	Date         string `json:"previous_date"`
}

type ReleaseDescription

type ReleaseDescription struct {
	Title           string   `json:"title"`
	Summary         string   `json:"summary"`
	ReleaseDate     string   `json:"release_date"`
	Published       bool     `json:"published"`
	Cancelled       bool     `json:"cancelled"`
	Finalised       bool     `json:"finalised"`
	Postponed       bool     `json:"postponed"`
	Census          bool     `json:"census"`
	Keywords        []string `json:"keywords,omitempty"`
	ProvisionalDate string   `json:"provisional_date,omitempty"`
	Language        string   `json:"language,omitempty"`
	CanonicalTopic  string   `json:"canonical_topic,omitempty"`
}

type ReleaseTransformer

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

func (*ReleaseTransformer) TransformSearchResponse

func (t *ReleaseTransformer) TransformSearchResponse(_ context.Context, responseData []byte, req query.ReleaseSearchRequest, highlight bool) ([]byte, error)

TransformSearchResponse transforms an elastic search response to a release query into a serialised ReleaseResponse

type SearchReleaseResponse

type SearchReleaseResponse struct {
	Took      int       `json:"took"`
	Breakdown Breakdown `json:"breakdown"`
	Releases  []Release `json:"releases"`
}

type Transformer

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

Transformer represents an instance of the ResponseTransformer interface for ES7x

func (*Transformer) TransformCountResponse added in v1.32.0

func (t *Transformer) TransformCountResponse(
	_ context.Context, responseData []byte) (int, error)

TransformCountResponse transforms an elastic search 7.x response

func (*Transformer) TransformSearchResponse

func (t *Transformer) TransformSearchResponse(
	_ context.Context, responseData []byte,
	query string, highlight bool) ([]byte, error)

TransformSearchResponse transforms an elastic search 7.x response

Jump to

Keyboard shortcuts

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