Documentation ¶
Index ¶
- type ESClusterInfo
- type Elasticsearch
- func (s *Elasticsearch) Close() error
- func (s *Elasticsearch) Configure(env *goboot.AppEnv) error
- func (s *Elasticsearch) IndexCreate(ctx context.Context, idx string) error
- func (s *Elasticsearch) IndexDelete(ctx context.Context, idx string) error
- func (s *Elasticsearch) IndexExists(ctx context.Context, idx string) (bool, error)
- func (s *Elasticsearch) Init() error
- func (s *Elasticsearch) InsertMigrationRecord(ctx context.Context, id string, elapsed time.Duration) error
- func (s *Elasticsearch) Migrate(ctx context.Context) error
- func (s *Elasticsearch) Name() string
- func (s *Elasticsearch) ParseResponse(res *esapi.Response, v any) error
- func (s *Elasticsearch) ParseResponseBytes(res *esapi.Response) ([]byte, error)
- type Migration
- type MigrationRecord
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) 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 (*Elasticsearch) Init ¶
func (s *Elasticsearch) Init() error
Init runs the Elasticsearch migrations.
func (*Elasticsearch) InsertMigrationRecord ¶
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 }
Click to show internal directories.
Click to hide internal directories.