result

package
v2.0.17 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ResultNotFound = `not_found`
	ResultCreated  = `created`
	ResultUpdated  = `updated`
	ResultDeleted  = `deleted`
)
View Source
const (
	RelationEq = `eq`
	RelationGt = `gt`
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Bulk

type Bulk struct {
	Result
	Errors bool                  `json:"errors"`
	Items  []map[string]DocIndex `json:"items"`
}

func ToBulk

func ToBulk(resp *http_client.Response, err error) (*Bulk, error)

func (*Bulk) HasError

func (b *Bulk) HasError() bool

type Column

type Column struct {
	Name string `json:"name"`
	Type string `json:"type"`
}

type DocIndex

type DocIndex struct {
	Result

	Id          string `json:"_id"`
	Version     int64  `json:"_version"`
	Res         string `json:"result"`
	SeqNo       int64  `json:"_seq_no"`
	PrimaryTerm int64  `json:"_primary_term"`
}

func ToDocIndex

func ToDocIndex(resp *http_client.Response, err error) (*DocIndex, error)

func (*DocIndex) IsRes

func (di *DocIndex) IsRes(result string) bool

type Document

type Document struct {
	DocIndex

	Source Source `json:"_source"`
}

type Documents

type Documents struct {
	Result

	Docs []Document `json:"docs"`
}

func ToDocuments

func ToDocuments(resp *http_client.Response, err error) (*Documents, error)

type Error

type Error struct {
	Type   string `json:"type"`
	Reason string `json:"reason"`
	Index  string `json:"index"`
}

type HitItem

type HitItem struct {
	Index  string `json:"_index"`
	Id     string `json:"_id"`
	Score  any    `json:"_score"`
	Source Source `json:"_source"`
	Sort   []any  `json:"sort"`
}

type Hits

type Hits struct {
	Total    Total     `json:"total"`
	MaxScore any       `json:"max_score"`
	Hits     []HitItem `json:"hits"`
}

type Index

type Index struct {
	Result

	Acknowledged bool `json:"acknowledged"`
}

func ToIndex

func ToIndex(resp *http_client.Response, err error) (*Index, error)

func (*Index) Ok

func (i *Index) Ok() bool

type IndexMapping

type IndexMapping map[string]Mappings

func ToMapping

func ToMapping(resp *http_client.Response, err error) (*IndexMapping, error)

type Mapping

type Mapping struct {
	Properties MappingProperties `json:"properties"`
}

type MappingProperties

type MappingProperties map[string]MappingProperty

type MappingProperty

type MappingProperty struct {
	Type     string `json:"type"`
	Format   string `json:"format,omitempty"`
	Analyzer string `json:"analyzer,omitempty"`
}

type Mappings

type Mappings struct {
	Mappings Mapping `json:"mappings"`
}

type Result

type Result struct {
	Error  *Error `json:"error"`
	Status int    `json:"status"`
}

func (*Result) HasError

func (r *Result) HasError() bool
type Search struct {
	Result

	Hits     Hits  `json:"hits"`
	TimedOut bool  `json:"timed_out"`
	Took     int64 `json:"took"`
}

func ToSearch

func ToSearch(resp *http_client.Response, err error) (*Search, error)

type Source

type Source kind.JsonParam

func (Source) Marshal

func (s Source) Marshal() []byte

type Sql

type Sql struct {
	Result

	Columns []Column `json:"columns"`
	Rows    [][]any  `json:"rows"`
	Cursor  string   `json:"cursor"`
}

func ToSql

func ToSql(resp *http_client.Response, err error) (*Sql, error)

func (*Sql) ToRecord

func (s *Sql) ToRecord() ([]Source, error)

type Total

type Total struct {
	Value    int64  `json:"value"`
	Relation string `json:"relation"`
}

Jump to

Keyboard shortcuts

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