Documentation
¶
Index ¶
- Constants
- func AppEndpoint(c flaps.ManagedPostgresCluster) flaps.ManagedPostgresEndpoint
- func AvailableRegionCodes(ctx context.Context) ([]string, error)
- func AvailableRegions(ctx context.Context) ([]fly.Region, error)
- func ConnectionURI(c flaps.ManagedPostgresCluster, password string) string
- func IsValidRegion(ctx context.Context, regionCode string) (bool, error)
- func PsqlProxyContext(ctx context.Context, o PsqlOptions) context.Context
- func RunPsql(ctx context.Context, psqlPath, connectURL string, options PsqlOptions) error
- func SupportedPGMajorVersionsText() string
- func ValidatePGMajorVersion(version int) error
- type PsqlOptions
Constants ¶
const ( DefaultUsername = "fly-user" DefaultDatabase = "fly-db" DefaultPort = 5432 DefaultPGMajorVersion = 17 )
Defaults for a Managed Postgres cluster.
Variables ¶
This section is empty.
Functions ¶
func AppEndpoint ¶ added in v0.5.15
func AppEndpoint(c flaps.ManagedPostgresCluster) flaps.ManagedPostgresEndpoint
AppEndpoint returns the endpoint an app's DATABASE_URL points at: the direct one on the Developer plan (dev-256), the pooler on the others.
func AvailableRegionCodes ¶
AvailableRegionCodes returns the codes of AvailableRegions.
func AvailableRegions ¶
AvailableRegions returns the non-deprecated regions where Managed Postgres is available, per the Machines API region list (fly.Region.MPGAvailable).
func ConnectionURI ¶
func ConnectionURI(c flaps.ManagedPostgresCluster, password string) string
ConnectionURI builds a libpq connection string for the cluster's default user and database via AppEndpoint, using the given password. The API returns no connection string, so flyctl assembles it client-side.
func IsValidRegion ¶
IsValidRegion reports whether Managed Postgres is available in the given region code.
func PsqlProxyContext ¶ added in v0.5.9
func PsqlProxyContext(ctx context.Context, o PsqlOptions) context.Context
PsqlProxyContext keeps diagnostics off psql's stdout for non-interactive or scripted sessions.
func RunPsql ¶ added in v0.5.9
func RunPsql(ctx context.Context, psqlPath, connectURL string, options PsqlOptions) error
RunPsql runs psql against connectURL and waits for it. Interrupts are forwarded to psql so Ctrl+C cancels the running query; a second one within two seconds ends the session.
func SupportedPGMajorVersionsText ¶ added in v0.5.15
func SupportedPGMajorVersionsText() string
SupportedPGMajorVersionsText lists the supported Postgres major versions for help and error text, as in "16, 17 and 18".
func ValidatePGMajorVersion ¶ added in v0.5.15
ValidatePGMajorVersion reports whether a new cluster can run the given Postgres major version.
Types ¶
type PsqlOptions ¶ added in v0.5.9
PsqlOptions describes SQL input and arguments passed through to psql.
func PsqlOptionsFromContext ¶ added in v0.5.9
func PsqlOptionsFromContext(ctx context.Context) PsqlOptions
PsqlOptionsFromContext reads the SQL flags and arguments passed through to psql.
func (PsqlOptions) Scripted ¶ added in v0.5.9
func (o PsqlOptions) Scripted() bool
Scripted reports whether SQL was supplied with --command or --file.