db

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: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client is a database client connection

func CreateClient

func CreateClient(config utils.PostgresConnectionConfig) (result *Client)

CreateClient creates an instance of Client with specified parameters Doesn't check connection to DB server

func (*Client) CreateDocument

func (dbc *Client) CreateDocument(indexName, typeName, document string, documentID string) (result *ElasticSearchDocument, err error)

CreateDocument creates a new document in database

func (*Client) CreateIndex

func (dbc *Client) CreateIndex(indexName, options string) (*IndexRecord, error)

CreateIndex creates an index record with specified options

func (*Client) CreateType

func (dbc *Client) CreateType(indexName, typeName, options string) (*TypeRecord, error)

CreateType creates a type record with specified options

func (*Client) DeleteDocument

func (dbc *Client) DeleteDocument(indexName, typeName string, documentID string) (*ElasticSearchDocument, error)

DeleteDocument deletes existing document in database

func (*Client) FindIndices

func (dbc *Client) FindIndices(indexPattern string) ([]string, error)

FindIndices searches for indicies using name pattern in ElasticSearch wildcard format

func (*Client) FindTypes

func (dbc *Client) FindTypes(index, typePattern string) ([]string, error)

FindTypes searches for indicies using name pattern in ElasticSearch wildcard format

func (*Client) GetDocument

func (dbc *Client) GetDocument(indexName, typeName string, documentID string) (*ElasticSearchDocument, error)

GetDocument gets document specified by index, type, and ID

func (*Client) GetIndex

func (dbc *Client) GetIndex(indexName string) (*IndexRecord, error)

GetIndex gets an instance of existing index

func (*Client) GetType

func (dbc *Client) GetType(indexName, typeName string) (*TypeRecord, error)

GetType gets an instance of existing type

func (*Client) InitializeSchema

func (dbc *Client) InitializeSchema() error

InitializeSchema initializes system tables used by pg_elastic Doesn't affect existing tables

func (*Client) IsDocumentExists

func (dbc *Client) IsDocumentExists(indexName, typeName string, documentID string) (bool, error)

IsDocumentExists checkes for document existence in database

func (*Client) NewQuery

func (dbc *Client) NewQuery(indexName, typeName string) *Query

NewQuery creates Query instance for specified index and type

func (*Client) ProcessSearchQuery

func (dbc *Client) ProcessSearchQuery(indexName, typeName string, query *Query) ([]ElasticSearchDocument, error)

ProcessSearchQuery does a processing of ElasticSearch-format query

func (*Client) UpdateDocument

func (dbc *Client) UpdateDocument(indexName, typeName, document string, documentID string) (result *ElasticSearchDocument, err error)

UpdateDocument updates existing document in database

func (*Client) UpdateTypeOptions

func (dbc *Client) UpdateTypeOptions(indexName, typeName, options string) (*TypeRecord, error)

UpdateTypeOptions updates options for exiting type

type ElasticSearchDocument

type ElasticSearchDocument struct {
	ID       string
	Document interface{}
	Version  int
}

ElasticSearchDocument represents ElasticSearch document stored in database

type IndexRecord

type IndexRecord struct {
	Name    string
	Options string
}

IndexRecord contains information about index stored in database

type Query

type Query = orm.Query

Query is alias for orm.Query type. Used to implement other packages of the project without linking it to pg/orm

type TypeRecord

type TypeRecord struct {
	Name      string
	IndexName string
	Options   string
}

TypeRecord contains information about type stored in database

Jump to

Keyboard shortcuts

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