utils

package
v0.0.0-...-982fec7 Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2021 License: BSD-2-Clause Imports: 4 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DBQueryError

type DBQueryError struct {
	ElasticErrorGeneral
}

DBQueryError is error caused by any internal error of the database

func NewDBQueryError

func NewDBQueryError(reason string) *DBQueryError

NewDBQueryError creates a new instance of DBQueryError

type ElasticError

type ElasticError interface {
	error
	Type() string
	Reason() string
	FormatErrorResponse() interface{}
}

ElasticError is a basic interface for any kind of errors produced by pg-elastic and can be represented as a JSON error report

type ElasticErrorBulk

type ElasticErrorBulk struct {
	ElasticErrorGeneral
	Index     string `json:"index"`
	Shard     string `json:"shard"`
	IndexUUID string `json:"index_uuid"`
}

ElasticErrorBulk represents a response format for JSON error report for bulk requests

func NewElasticErrorBulk

func NewElasticErrorBulk(err ElasticError, index, shard, indexUUID string) *ElasticErrorBulk

NewElasticErrorBulk creates a new instance of ElasticErrorBulk

func (*ElasticErrorBulk) FormatErrorResponse

func (err *ElasticErrorBulk) FormatErrorResponse() interface{}

FormatErrorResponse generates an JSON output for an error

type ElasticErrorGeneral

type ElasticErrorGeneral struct {
	TypeVal   string `json:"type"`
	ReasonVal string `json:"reason"`
}

ElasticErrorGeneral represents a response format for JSON error report 'cause' part

func (*ElasticErrorGeneral) Error

func (err *ElasticErrorGeneral) Error() string

func (*ElasticErrorGeneral) FormatErrorResponse

func (err *ElasticErrorGeneral) FormatErrorResponse() interface{}

FormatErrorResponse generates an JSON output for an error

func (*ElasticErrorGeneral) Reason

func (err *ElasticErrorGeneral) Reason() string

Reason returns the error reason

func (*ElasticErrorGeneral) Type

func (err *ElasticErrorGeneral) Type() string

Type returns name of the error type

type ElasticErrorGeneralResponse

type ElasticErrorGeneralResponse struct {
	RootCause []ElasticErrorGeneral `json:"root_cause"`
	ElasticErrorGeneral
}

ElasticErrorGeneralResponse represents a response format for JSON error report

type FieldMapping

type FieldMapping struct {
	TypeName string `json:"type"`
	Analyzer string `json:"analyzer"`
}

FieldMapping represents a processing mapping for a field

func GetFieldMapping

func GetFieldMapping(mapping map[string]interface{}, fieldName string) (*FieldMapping, bool)

GetFieldMapping extracts field mapping from type mapping object

type IllegalQueryError

type IllegalQueryError struct {
	ElasticErrorGeneral
}

IllegalQueryError is error caused by misconstructed query

func NewIllegalQueryError

func NewIllegalQueryError(reason string) *IllegalQueryError

NewIllegalQueryError creates a new instance of IllegalQueryError

type InternalError

type InternalError struct {
	ElasticErrorGeneral
}

InternalError is error caused by pg-elastic itself

func NewInternalError

func NewInternalError(reason string) *InternalError

NewInternalError creates a new instance of InternalError

type InternalIOError

type InternalIOError struct {
	ElasticErrorGeneral
}

InternalIOError is error caused by any other IO operations

func NewInternalIOError

func NewInternalIOError(reason string) *InternalIOError

NewInternalIOError creates a new instance of InternalIOError

type JSONWrongFormatError

type JSONWrongFormatError struct {
	ElasticErrorGeneral
}

JSONWrongFormatError is error caused by illegal JSON input

func NewJSONWrongFormatError

func NewJSONWrongFormatError(reason string) *JSONWrongFormatError

NewJSONWrongFormatError creates a new instance of JSONWrongFormatError

type PGElasticConfig

type PGElasticConfig struct {
	ServerPort     int
	PostgresConfig PostgresConnectionConfig
}

PGElasticConfig represents structure of the pg-elastic configuration

func ReadConfig

func ReadConfig(path string) *PGElasticConfig

ReadConfig reads a configuration from the file at path

type PostgresConnectionConfig

type PostgresConnectionConfig struct {
	ServerAddress string
	User          string
	Password      string
	DBName        string
}

PostgresConnectionConfig represents structure of the pg-elastic Postgres connection configuration

Jump to

Keyboard shortcuts

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