meilisearch

package module
v0.41.0 Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithMasterKey

func WithMasterKey(masterKey string) testcontainers.CustomizeRequestOption

WithMasterKey sets the master key for the Meilisearch container it satisfies the testcontainers.ContainerCustomizer interface

Types

type MeilisearchContainer

type MeilisearchContainer struct {
	testcontainers.Container
	// contains filtered or unexported fields
}

MeilisearchContainer represents the Meilisearch container type used in the module

func Run

Run creates an instance of the Meilisearch container type

Example
// runMeilisearchContainer {
ctx := context.Background()

meiliContainer, err := meilisearch.Run(
	ctx,
	"getmeili/meilisearch:v1.10.3",
	meilisearch.WithMasterKey("my-master-key"),
	meilisearch.WithDumpImport("testdata/movies.dump"),
)
defer func() {
	if err := testcontainers.TerminateContainer(meiliContainer); err != nil {
		log.Printf("failed to terminate container: %s", err)
	}
}()
if err != nil {
	log.Printf("failed to start container: %s", err)
	return
}
// }

state, err := meiliContainer.State(ctx)
if err != nil {
	log.Printf("failed to get container state: %s", err)
	return
}

fmt.Println(state.Running)
fmt.Printf("%s\n", meiliContainer.MasterKey())
Output:

true
my-master-key

func (*MeilisearchContainer) Address

func (c *MeilisearchContainer) Address(ctx context.Context) (string, error)

Address retrieves the address of the Meilisearch container. It will use http as protocol, as TLS is not supported at the moment.

func (*MeilisearchContainer) MasterKey

func (c *MeilisearchContainer) MasterKey() string

MasterKey retrieves the master key of the Meilisearch container

type Option

type Option func(*Options)

Option is an option for the Meilisearch container.

func WithDumpImport

func WithDumpImport(dumpFilePath string) Option

WithDumpImport sets the data dump file path for the Meilisearch container. dumpFilePath either relative to where you call meilisearch run or absolute path

func (Option) Customize

Customize is a NOOP. It's defined to satisfy the testcontainers.ContainerCustomizer interface.

type Options

type Options struct {
	DumpDataFilePath string
	DumpDataFileName string
}

Options is a struct for specifying options for the Meilisearch container.

Jump to

Keyboard shortcuts

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