postgresql

package
v0.47.0 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PoolModeTypeChoices

func PoolModeTypeChoices() []string

Types

type ExtensionOut

type ExtensionOut struct {
	Name     string   `json:"name"`               // Extension name
	Versions []string `json:"versions,omitempty"` // Extension versions available
}

type Handler

type Handler interface {
	// PGServiceAvailableExtensions list PostgreSQL extensions that can be loaded with CREATE EXTENSION in this service
	// GET /v1/project/{project}/service/{service_name}/pg/available-extensions
	// https://api.aiven.io/doc/#tag/Service:_PostgreSQL/operation/PGServiceAvailableExtensions
	PGServiceAvailableExtensions(ctx context.Context, project string, serviceName string) ([]ExtensionOut, error)

	// PGServiceQueryStatistics fetch PostgreSQL service query statistics
	// POST /v1/project/{project}/service/{service_name}/pg/query/stats
	// https://api.aiven.io/doc/#tag/Service:_PostgreSQL/operation/PGServiceQueryStatistics
	PGServiceQueryStatistics(ctx context.Context, project string, serviceName string, in *PgserviceQueryStatisticsIn) ([]QueryOut, error)

	// PgAvailableExtensions list PostgreSQL extensions available for this tenant grouped by PG version
	// GET /v1/tenants/{tenant}/pg-available-extensions
	// https://api.aiven.io/doc/#tag/Service/operation/PgAvailableExtensions
	PgAvailableExtensions(ctx context.Context, tenant string) ([]PgOut, error)

	// ServicePGBouncerCreate create a new connection pool for service
	// POST /v1/project/{project}/service/{service_name}/connection_pool
	// https://api.aiven.io/doc/#tag/Service:_PostgreSQL/operation/ServicePGBouncerCreate
	ServicePGBouncerCreate(ctx context.Context, project string, serviceName string, in *ServicePgbouncerCreateIn) error

	// ServicePGBouncerDelete delete a connection pool
	// DELETE /v1/project/{project}/service/{service_name}/connection_pool/{pool_name}
	// https://api.aiven.io/doc/#tag/Service:_PostgreSQL/operation/ServicePGBouncerDelete
	ServicePGBouncerDelete(ctx context.Context, project string, serviceName string, poolName string) error

	// ServicePGBouncerUpdate update a connection pool
	// PUT /v1/project/{project}/service/{service_name}/connection_pool/{pool_name}
	// https://api.aiven.io/doc/#tag/Service:_PostgreSQL/operation/ServicePGBouncerUpdate
	ServicePGBouncerUpdate(ctx context.Context, project string, serviceName string, poolName string, in *ServicePgbouncerUpdateIn) error
}

type PgOut

type PgOut struct {
	Extensions []ExtensionOut `json:"extensions"` // Extensions available for loading with CREATE EXTENSION in this service
	Version    string         `json:"version"`    // PostgreSQL version
}

type PgserviceQueryStatisticsIn

type PgserviceQueryStatisticsIn struct {
	Limit   *int    `json:"limit,omitempty"`    // Limit for number of results
	Offset  *int    `json:"offset,omitempty"`   // Offset for retrieved results based on sort order
	OrderBy *string `json:"order_by,omitempty"` // Order in which to sort retrieved results
}

PgserviceQueryStatisticsIn PGServiceQueryStatisticsRequestBody

type PoolModeType

type PoolModeType string
const (
	PoolModeTypeSession     PoolModeType = "session"
	PoolModeTypeTransaction PoolModeType = "transaction"
	PoolModeTypeStatement   PoolModeType = "statement"
)

type PostgreSQLHandler

type PostgreSQLHandler struct {
	// contains filtered or unexported fields
}

func NewHandler

func NewHandler(doer doer) PostgreSQLHandler

func (*PostgreSQLHandler) PGServiceAvailableExtensions

func (h *PostgreSQLHandler) PGServiceAvailableExtensions(ctx context.Context, project string, serviceName string) ([]ExtensionOut, error)

func (*PostgreSQLHandler) PGServiceQueryStatistics

func (h *PostgreSQLHandler) PGServiceQueryStatistics(ctx context.Context, project string, serviceName string, in *PgserviceQueryStatisticsIn) ([]QueryOut, error)

func (*PostgreSQLHandler) PgAvailableExtensions

func (h *PostgreSQLHandler) PgAvailableExtensions(ctx context.Context, tenant string) ([]PgOut, error)

func (*PostgreSQLHandler) ServicePGBouncerCreate

func (h *PostgreSQLHandler) ServicePGBouncerCreate(ctx context.Context, project string, serviceName string, in *ServicePgbouncerCreateIn) error

func (*PostgreSQLHandler) ServicePGBouncerDelete

func (h *PostgreSQLHandler) ServicePGBouncerDelete(ctx context.Context, project string, serviceName string, poolName string) error

func (*PostgreSQLHandler) ServicePGBouncerUpdate

func (h *PostgreSQLHandler) ServicePGBouncerUpdate(ctx context.Context, project string, serviceName string, poolName string, in *ServicePgbouncerUpdateIn) error

type QueryOut

type QueryOut struct {
	BlkReadTime       *float64 `json:"blk_read_time,omitempty"`       // Query statistic
	BlkWriteTime      *float64 `json:"blk_write_time,omitempty"`      // Query statistic
	Calls             *float64 `json:"calls,omitempty"`               // Query statistic
	DatabaseName      *string  `json:"database_name,omitempty"`       // Query statistic
	LocalBlksDirtied  *float64 `json:"local_blks_dirtied,omitempty"`  // Query statistic
	LocalBlksHit      *float64 `json:"local_blks_hit,omitempty"`      // Query statistic
	LocalBlksRead     *float64 `json:"local_blks_read,omitempty"`     // Query statistic
	LocalBlksWritten  *float64 `json:"local_blks_written,omitempty"`  // Query statistic
	MaxPlanTime       *float64 `json:"max_plan_time,omitempty"`       // Query statistic
	MaxTime           *float64 `json:"max_time,omitempty"`            // Query statistic
	MeanPlanTime      *float64 `json:"mean_plan_time,omitempty"`      // Query statistic
	MeanTime          *float64 `json:"mean_time,omitempty"`           // Query statistic
	MinPlanTime       *float64 `json:"min_plan_time,omitempty"`       // Query statistic
	MinTime           *float64 `json:"min_time,omitempty"`            // Query statistic
	Query             *string  `json:"query,omitempty"`               // Query statistic
	Queryid           *float64 `json:"queryid,omitempty"`             // Query statistic
	Rows              *float64 `json:"rows,omitempty"`                // Query statistic
	SharedBlksDirtied *float64 `json:"shared_blks_dirtied,omitempty"` // Query statistic
	SharedBlksHit     *float64 `json:"shared_blks_hit,omitempty"`     // Query statistic
	SharedBlksRead    *float64 `json:"shared_blks_read,omitempty"`    // Query statistic
	SharedBlksWritten *float64 `json:"shared_blks_written,omitempty"` // Query statistic
	StddevPlanTime    *float64 `json:"stddev_plan_time,omitempty"`    // Query statistic
	StddevTime        *float64 `json:"stddev_time,omitempty"`         // Query statistic
	TempBlksRead      *float64 `json:"temp_blks_read,omitempty"`      // Query statistic
	TempBlksWritten   *float64 `json:"temp_blks_written,omitempty"`   // Query statistic
	TotalPlanTime     *float64 `json:"total_plan_time,omitempty"`     // Query statistic
	TotalTime         *float64 `json:"total_time,omitempty"`          // Query statistic
	UserName          *string  `json:"user_name,omitempty"`           // Query statistic
	WalBytes          *string  `json:"wal_bytes,omitempty"`           // Query statistic
	WalFpi            *float64 `json:"wal_fpi,omitempty"`             // Query statistic
	WalRecords        *float64 `json:"wal_records,omitempty"`         // Query statistic
}

type ServicePgbouncerCreateIn

type ServicePgbouncerCreateIn struct {
	Database string       `json:"database"`            // Service database name
	PoolMode PoolModeType `json:"pool_mode,omitempty"` // PGBouncer pool mode
	PoolName string       `json:"pool_name"`           // Connection pool name
	PoolSize *int         `json:"pool_size,omitempty"` // Size of PGBouncer's PostgreSQL side connection pool
	Username *string      `json:"username,omitempty"`  // Service username
}

ServicePgbouncerCreateIn ServicePGBouncerCreateRequestBody

type ServicePgbouncerUpdateIn

type ServicePgbouncerUpdateIn struct {
	Database *string      `json:"database,omitempty"`  // Service database name
	PoolMode PoolModeType `json:"pool_mode,omitempty"` // PGBouncer pool mode
	PoolSize *int         `json:"pool_size,omitempty"` // Size of PGBouncer's PostgreSQL side connection pool
	Username *string      `json:"username,omitempty"`  // Service username
}

ServicePgbouncerUpdateIn ServicePGBouncerUpdateRequestBody

Jump to

Keyboard shortcuts

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