esboot

package
v0.0.0-...-3c51467 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2022 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ESClusterInfo

type ESClusterInfo struct {
	ClusterName string `json:"cluster_name"`
}

type Elasticsearch

type Elasticsearch struct {
	Migrations      []*Migration
	MigrationsIndex string

	*elasticsearch7.Client
	*elasticsearch7.Config
	// contains filtered or unexported fields
}

func (*Elasticsearch) Close

func (s *Elasticsearch) Close() error

func (*Elasticsearch) Configure

func (s *Elasticsearch) Configure(env *goboot.AppEnv) error

func (*Elasticsearch) IndexCreate

func (s *Elasticsearch) IndexCreate(ctx context.Context, idx string) error

func (*Elasticsearch) IndexDelete

func (s *Elasticsearch) IndexDelete(ctx context.Context, idx string) error

func (*Elasticsearch) IndexExists

func (s *Elasticsearch) IndexExists(ctx context.Context, idx string) (bool, error)

func (*Elasticsearch) Init

func (s *Elasticsearch) Init() error

Init runs the Elasticsearch migrations.

func (*Elasticsearch) InsertMigrationRecord

func (s *Elasticsearch) InsertMigrationRecord(ctx context.Context, id string, elapsed time.Duration) error

func (*Elasticsearch) Migrate

func (s *Elasticsearch) Migrate(ctx context.Context) error

func (*Elasticsearch) Name

func (s *Elasticsearch) Name() string

func (*Elasticsearch) ParseResponse

func (s *Elasticsearch) ParseResponse(res *esapi.Response, v any) error

ParseResponse decodes the Elasticsearch response body. The response body may contain errors which is why it's advisable to always parse the response even you're not interested in the actual body.

If r is nil does not decode non-error response body.

Closes the response body when done.

func (*Elasticsearch) ParseResponseBytes

func (s *Elasticsearch) ParseResponseBytes(res *esapi.Response) ([]byte, error)

ParseResponseBytes parses the Elasticsearch response body to a byte array. The response body may contain errors which is why it's advisable to always parse the response even you're not interested in the actual body.

Closes the response body when done.

type Migration

type Migration struct {
	ID      string
	Migrate func(es *Elasticsearch) error
}

type MigrationRecord

type MigrationRecord struct {
	ID        string    `json:"id"`
	Timestamp time.Time `json:"timestamp"`
	Duration  string    `json:"duration"`
}

Jump to

Keyboard shortcuts

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