influxdb

package module
v0.35.0 Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithConfigFile

func WithConfigFile(configFile string) testcontainers.CustomizeRequestOption

func WithDatabase

func WithDatabase(database string) testcontainers.CustomizeRequestOption

func WithInitDb

func WithInitDb(srcPath string) testcontainers.CustomizeRequestOption

WithInitDb returns a request customizer that initialises the database using the file `docker-entrypoint-initdb.d` located in `srcPath` directory.

func WithPassword

func WithPassword(password string) testcontainers.CustomizeRequestOption

func WithUsername

func WithUsername(username string) testcontainers.CustomizeRequestOption

Types

type InfluxDbContainer

type InfluxDbContainer struct {
	testcontainers.Container
}

InfluxDbContainer represents the MySQL container type used in the module

func Run added in v0.32.0

func Run(ctx context.Context, img string, opts ...testcontainers.ContainerCustomizer) (*InfluxDbContainer, error)

Run creates an instance of the InfluxDB container type

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

influxdbContainer, err := influxdb.Run(ctx,
	"influxdb:1.8.10",
	influxdb.WithDatabase("influx"),
	influxdb.WithUsername("root"),
	influxdb.WithPassword("password"),
)
defer func() {
	if err := testcontainers.TerminateContainer(influxdbContainer); err != nil {
		log.Printf("failed to terminate container: %s", err)
	}
}()
if err != nil {
	log.Printf("failed to start container: %s", err)
	return
}
// }

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

fmt.Println(state.Running)
Output:

true

func RunContainer deprecated

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

Deprecated: use Run instead RunContainer creates an instance of the InfluxDB container type

func (*InfluxDbContainer) ConnectionUrl

func (c *InfluxDbContainer) ConnectionUrl(ctx context.Context) (string, error)

func (*InfluxDbContainer) MustConnectionUrl

func (c *InfluxDbContainer) MustConnectionUrl(ctx context.Context) string

Jump to

Keyboard shortcuts

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