Documentation
¶
Overview ¶
Package ditto provides a Go client for provisioning ephemeral database copies from a running ditto server.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewCopy ¶
NewCopy creates an ephemeral database copy on the ditto server, registers t.Cleanup to delete it when the test finishes, and returns the connection string. Calls t.Fatal on any error.
Example:
dsn := ditto.NewCopy(t,
ditto.WithServerURL("http://ditto.internal:8080"),
ditto.WithToken(os.Getenv("DITTO_TOKEN")),
ditto.WithTTL(10*time.Minute),
)
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client talks to a ditto server to provision ephemeral database copies.
func (*Client) WithCopy ¶
WithCopy creates a copy, calls fn with its connection string, then destroys the copy when fn returns — regardless of whether fn returns an error. This is the non-test counterpart to NewCopy; use it in scripts, CLIs, or any context where testing.TB is unavailable.
err := client.WithCopy(ctx, func(dsn string) error {
return migrate(dsn)
})
type Option ¶
type Option func(*Client)
Option configures a Client.
func WithServerURL ¶
WithServerURL sets the base URL of the ditto server (e.g. "http://ditto.internal:8080").