kurrentdb

package module
v0.44.0 Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithInsecure

WithInsecure sets the container to run in insecure mode (no TLS). This is the default behaviour; the option exists for explicitness.

Types

type Container

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

Container represents the KurrentDB container type used in the module.

func Run

Run creates an instance of the KurrentDB container type.

Example
package main

import (
	"context"
	"fmt"
	"log"

	"github.com/testcontainers/testcontainers-go"
	"github.com/testcontainers/testcontainers-go/modules/kurrentdb"
)

func main() {
	// runKurrentDBContainer {
	ctx := context.Background()

	kurrentdbContainer, err := kurrentdb.Run(ctx, "kurrentplatform/kurrentdb:26.1.1")
	defer func() {
		if err := testcontainers.TerminateContainer(kurrentdbContainer); err != nil {
			log.Printf("failed to terminate container: %s", err)
		}
	}()
	if err != nil {
		log.Printf("failed to start container: %s", err)
		return
	}
	// }

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

	fmt.Println(state.Running)

}
Output:
true
Example (WithInsecure)
package main

import (
	"context"
	"fmt"
	"log"

	"github.com/testcontainers/testcontainers-go"
	"github.com/testcontainers/testcontainers-go/modules/kurrentdb"
)

func main() {
	ctx := context.Background()

	// withInsecure {
	kurrentdbContainer, err := kurrentdb.Run(ctx,
		"kurrentplatform/kurrentdb:26.1.1",
		kurrentdb.WithInsecure(),
	)
	// }
	defer func() {
		if err := testcontainers.TerminateContainer(kurrentdbContainer); err != nil {
			log.Printf("failed to terminate container: %s", err)
		}
	}()
	if err != nil {
		log.Printf("failed to start container: %s", err)
		return
	}

	// connectionString {
	connStr, err := kurrentdbContainer.ConnectionString(ctx)
	// }
	if err != nil {
		log.Printf("failed to get connection string: %s", err)
		return
	}

	fmt.Println(connStr != "")

}
Output:
true

func (*Container) ConnectionString

func (c *Container) ConnectionString(ctx context.Context) (string, error)

ConnectionString returns the connection string for the KurrentDB container. When the container is running in insecure mode (no TLS), the returned URL includes "?tls=false"; otherwise only the base URL is returned.

Jump to

Keyboard shortcuts

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