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 QuestDB container type used in the module.
func Run ¶
func Run(ctx context.Context, img string, opts ...testcontainers.ContainerCustomizer) (*Container, error)
Run creates an instance of the QuestDB container type.
Example ¶
package main
import (
"context"
"fmt"
"log"
"github.com/testcontainers/testcontainers-go"
"github.com/testcontainers/testcontainers-go/modules/questdb"
)
func main() {
// runQuestDBContainer {
ctx := context.Background()
questdbContainer, err := questdb.Run(ctx, "questdb/questdb:7.4.2")
defer func() {
if err := testcontainers.TerminateContainer(questdbContainer); err != nil {
log.Printf("failed to terminate container: %s", err)
}
}()
if err != nil {
log.Printf("failed to start container: %s", err)
return
}
// }
state, err := questdbContainer.State(ctx)
if err != nil {
log.Printf("failed to get container state: %s", err)
return
}
fmt.Println(state.Running)
}
Output: true
func (*Container) HTTPEndpoint ¶
HTTPEndpoint returns the HTTP endpoint (Web Console and REST API) of the QuestDB container. The returned URL has the format "http://host:port".
Example ¶
package main
import (
"context"
"fmt"
"log"
"github.com/testcontainers/testcontainers-go"
"github.com/testcontainers/testcontainers-go/modules/questdb"
)
func main() {
ctx := context.Background()
questdbContainer, err := questdb.Run(ctx, "questdb/questdb:7.4.2")
defer func() {
if err := testcontainers.TerminateContainer(questdbContainer); err != nil {
log.Printf("failed to terminate container: %s", err)
}
}()
if err != nil {
log.Printf("failed to start container: %s", err)
return
}
// httpEndpoint {
httpEndpoint, err := questdbContainer.HTTPEndpoint(ctx)
// }
if err != nil {
log.Printf("failed to get HTTP endpoint: %s", err)
return
}
fmt.Println(httpEndpoint != "")
}
Output: true
func (*Container) InfluxDBEndpoint ¶
InfluxDBEndpoint returns the InfluxDB line protocol endpoint of the QuestDB container. The returned address has the format "host:port".
Example ¶
package main
import (
"context"
"fmt"
"log"
"github.com/testcontainers/testcontainers-go"
"github.com/testcontainers/testcontainers-go/modules/questdb"
)
func main() {
ctx := context.Background()
questdbContainer, err := questdb.Run(ctx, "questdb/questdb:7.4.2")
defer func() {
if err := testcontainers.TerminateContainer(questdbContainer); err != nil {
log.Printf("failed to terminate container: %s", err)
}
}()
if err != nil {
log.Printf("failed to start container: %s", err)
return
}
// influxDBEndpoint {
ilpEndpoint, err := questdbContainer.InfluxDBEndpoint(ctx)
// }
if err != nil {
log.Printf("failed to get InfluxDB line protocol endpoint: %s", err)
return
}
fmt.Println(ilpEndpoint != "")
}
Output: true
func (*Container) PGEndpoint ¶
PGEndpoint returns the PostgreSQL wire protocol connection string for the QuestDB container. The returned URL has the format "postgres://admin:[REDACTED]@host:port/qdb".
Example ¶
package main
import (
"context"
"fmt"
"log"
"github.com/testcontainers/testcontainers-go"
"github.com/testcontainers/testcontainers-go/modules/questdb"
)
func main() {
ctx := context.Background()
questdbContainer, err := questdb.Run(ctx, "questdb/questdb:7.4.2")
defer func() {
if err := testcontainers.TerminateContainer(questdbContainer); err != nil {
log.Printf("failed to terminate container: %s", err)
}
}()
if err != nil {
log.Printf("failed to start container: %s", err)
return
}
// pgEndpoint {
pgEndpoint, err := questdbContainer.PGEndpoint(ctx)
// }
if err != nil {
log.Printf("failed to get PG endpoint: %s", err)
return
}
fmt.Println(pgEndpoint != "")
}
Output: true
Click to show internal directories.
Click to hide internal directories.