surrealdb

package module
v0.30.0 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithAllowAllCaps

func WithAllowAllCaps() testcontainers.CustomizeRequestOption

WithAllowAllCaps enables all caps for the SurrealDB instance

func WithAuthentication

func WithAuthentication() testcontainers.CustomizeRequestOption

WithAuthentication enables authentication for the SurrealDB instance

func WithPassword

func WithPassword(password string) testcontainers.CustomizeRequestOption

WithPassword sets the initial password of the user to be created when the container starts It is used in conjunction with WithUsername to set a username and its password. It will set the superuser password for SurrealDB.

func WithStrictMode

func WithStrictMode() testcontainers.CustomizeRequestOption

WithStrict enables strict mode for the SurrealDB instance

func WithUsername

func WithUsername(username string) testcontainers.CustomizeRequestOption

WithUser sets the initial username to be created when the container starts It is used in conjunction with WithPassword to set a username and its password. It will create the specified user with superuser power.

Types

type SurrealDBContainer

type SurrealDBContainer struct {
	testcontainers.Container
}

SurrealDBContainer represents the SurrealDB container type used in the module

func RunContainer

func RunContainer(ctx context.Context, opts ...testcontainers.ContainerCustomizer) (*SurrealDBContainer, error)

RunContainer creates an instance of the SurrealDB container type

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

surrealdbContainer, err := surrealdb.RunContainer(ctx, testcontainers.WithImage("surrealdb/surrealdb:v1.1.1"))
if err != nil {
	log.Fatal(err)
}

// Clean up the container
defer func() {
	if err := surrealdbContainer.Terminate(ctx); err != nil {
		log.Fatal(err)
	}
}()
// }

state, err := surrealdbContainer.State(ctx)
if err != nil {
	log.Fatal(err) // nolint:gocritic
}

fmt.Println(state.Running)
Output:

true

func (*SurrealDBContainer) URL

ConnectionString returns the connection string for the OpenLDAP container

Jump to

Keyboard shortcuts

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