Help us shape the future of Go! Take the 2026 Go Developer Survey

ravendb

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: 5 Imported by: 0

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Container

type Container struct {
	testcontainers.Container
}

Container represents the RavenDB container type used in the module

func Run

Run creates an instance of the RavenDB container type

Example

ExampleRun demonstrates how to create and start a RavenDB container.

package main

import (
	"context"
	"fmt"
	"log"

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

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

	ravendbContainer, err := ravendb.Run(ctx, "ravendb/ravendb:6.0-ubuntu-latest")
	defer func() {
		if err := testcontainers.TerminateContainer(ravendbContainer); err != nil {
			log.Printf("failed to terminate container: %s", err)
		}
	}()
	if err != nil {
		log.Printf("failed to start container: %s", err)
		return
	}
	// }

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

	fmt.Println(state.Running)

}
Output:
true
Example (ManagementURL)

ExampleRun_managementURL demonstrates how to retrieve the RavenDB management URL.

package main

import (
	"context"
	"fmt"
	"log"

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

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

	ravendbContainer, err := ravendb.Run(ctx, "ravendb/ravendb:6.0-ubuntu-latest")
	defer func() {
		if err := testcontainers.TerminateContainer(ravendbContainer); err != nil {
			log.Printf("failed to terminate container: %s", err)
		}
	}()
	if err != nil {
		log.Printf("failed to start container: %s", err)
		return
	}

	managementURL, err := ravendbContainer.ManagementURL(ctx)
	if err != nil {
		log.Printf("failed to get management URL: %s", err)
		return
	}

	isHTTP := len(managementURL) > 7 && managementURL[:7] == "http://"
	fmt.Println(isHTTP)

}
Output:
true

func (*Container) ManagementURL

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

ManagementURL returns the URL of the RavenDB management interface (Studio UI and REST API). The URL has the format http://<host>:<port>.

func (*Container) TCPEndpoint

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

TCPEndpoint returns the host:port endpoint for RavenDB's TCP port (38888), used for subscriptions and cluster/replication communication.

Jump to

Keyboard shortcuts

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