opensearch

package
v0.0.0-...-886d360 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidContent = errors.New("invalid migration content")
)

Functions

func ReadErrorFromResponse

func ReadErrorFromResponse(resp *http.Response) error

Types

type Migration

type Migration struct {
	Method  string         `json:"method"`
	URL     string         `json:"url"`
	Params  url.Values     `json:"params,omitempty"`
	Body    map[string]any `json:"body,omitempty"`
	Headers http.Header    `json:"headers,omitempty"`
}

func NewMigrationFromRawContent

func NewMigrationFromRawContent(content []byte) (Migration, error)

func (Migration) CreateRequest

func (m Migration) CreateRequest() (*http.Request, error)

func (Migration) Validate

func (m Migration) Validate() error

type MigrationsIndexManager

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

func NewMigrationsIndexManager

func NewMigrationsIndexManager(transport opensearchapi.Transport) MigrationsIndexManager

func (MigrationsIndexManager) Create

func (m MigrationsIndexManager) Create(name string) error

func (MigrationsIndexManager) Exists

func (m MigrationsIndexManager) Exists(name string) (bool, error)

func (MigrationsIndexManager) Upsert

func (m MigrationsIndexManager) Upsert(name string) error

type MigrationsIndexManagerInterface

type MigrationsIndexManagerInterface interface {
	Upsert(name string) error
	Exists(name string) (bool, error)
	Create(name string) error
}

type OpenSearch

type OpenSearch struct {
	MigrationSequence []string
	LastRunMigration  []byte
	// contains filtered or unexported fields
}

func NewDriver

func NewDriver(
	transport opensearchapi.Transport,
	manager MigrationsIndexManagerInterface,
) *OpenSearch

func (*OpenSearch) Close

func (o *OpenSearch) Close() error

func (*OpenSearch) Drop

func (o *OpenSearch) Drop() error

func (*OpenSearch) Lock

func (o *OpenSearch) Lock() error

func (*OpenSearch) Open

func (o *OpenSearch) Open(_ string) (database.Driver, error)

func (*OpenSearch) Run

func (o *OpenSearch) Run(migration io.Reader) error

func (*OpenSearch) SetVersion

func (o *OpenSearch) SetVersion(version int, dirty bool) error

func (*OpenSearch) Unlock

func (o *OpenSearch) Unlock() error

func (*OpenSearch) Version

func (o *OpenSearch) Version() (version int, dirty bool, err error)

Jump to

Keyboard shortcuts

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