firebird

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

Documentation

Overview

Package firebird provides a Testcontainers module for running Firebird database containers.

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithDatabase

func WithDatabase(name string) testcontainers.CustomizeRequestOption

WithDatabase sets the FIREBIRD_DATABASE environment variable to configure the name of the database file to create or connect to.

func WithPassword

func WithPassword(password string) testcontainers.CustomizeRequestOption

WithPassword sets the FIREBIRD_PASSWORD environment variable to configure the password for the database user.

func WithSYSDBAPassword

func WithSYSDBAPassword(password string) testcontainers.CustomizeRequestOption

WithSYSDBAPassword sets the ISC_PASSWORD environment variable to configure the SYSDBA master password.

func WithUsername

func WithUsername(user string) testcontainers.CustomizeRequestOption

WithUsername sets the FIREBIRD_USER environment variable to configure the database user.

Types

type Container

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

Container represents the Firebird container type used in the module.

func Run

Run creates an instance of the Firebird container type. The default image is jacobalberty/firebird:v3.0.

Example
package main

import (
	"context"
	"fmt"
	"log"

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

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

	firebirdContainer, err := firebird.Run(ctx,
		"jacobalberty/firebird:v3.0",
		firebird.WithDatabase("test.fdb"),
		firebird.WithUsername("test"),
		firebird.WithPassword("test"),
	)
	defer func() {
		if err := testcontainers.TerminateContainer(firebirdContainer); err != nil {
			log.Printf("failed to terminate container: %s", err)
		}
	}()
	if err != nil {
		log.Printf("failed to start container: %s", err)
		return
	}
	// }

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

	fmt.Println(state.Running)

}
Output:
true

func (*Container) ConnectionString

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

ConnectionString returns the connection string for the Firebird container. It uses the firebird:// scheme and the full server-side path to the database file (/firebird/data/<name>), which is where the jacobalberty/firebird image creates the database. IPv6 hosts are handled correctly via net.JoinHostPort.

Jump to

Keyboard shortcuts

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