pginternal

package
v0.0.0-...-dac6614 Latest Latest
Warning

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

Go to latest
Published: May 3, 2026 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Exec

func Exec(ctx context.Context, q Querier, sql string, args ...any) (int64, error)

Exec executes a statement and returns the number of rows affected.

func QueryRow

func QueryRow(ctx context.Context, q Querier, sql string, args ...any) pgx.Row

QueryRow executes a query that returns a single row via the Querier abstraction.

func QueryRows

func QueryRows(ctx context.Context, q Querier, sql string, args ...any) (pgx.Rows, error)

QueryRows executes a query that returns rows via the Querier abstraction.

Types

type K8sClient

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

K8sClient wraps the Kubernetes dynamic client for CNPG operations.

func NewK8sClientFromDynamic

func NewK8sClientFromDynamic(client dynamic.Interface, namespace string) *K8sClient

NewK8sClientFromDynamic creates a K8sClient from an existing dynamic.Interface (for testing).

func (*K8sClient) CreateBackup

CreateBackup creates a CNPG Backup resource.

func (*K8sClient) GetCluster

func (k *K8sClient) GetCluster(ctx context.Context, name string) (*unstructured.Unstructured, error)

GetCluster retrieves a CNPG Cluster by name.

func (*K8sClient) ListBackups

func (k *K8sClient) ListBackups(ctx context.Context, labelSelector string) (*unstructured.UnstructuredList, error)

ListBackups lists CNPG Backup resources.

func (*K8sClient) ListClusters

func (k *K8sClient) ListClusters(ctx context.Context) (*unstructured.UnstructuredList, error)

ListClusters lists all CNPG Clusters in the namespace.

func (*K8sClient) Namespace

func (k *K8sClient) Namespace() string

Namespace returns the configured namespace.

func (*K8sClient) PatchCluster

func (k *K8sClient) PatchCluster(ctx context.Context, name string, patchData []byte) error

PatchCluster applies a merge patch to a CNPG Cluster.

type Querier

type Querier interface {
	Query(ctx context.Context, sql string, args ...any) (pgx.Rows, error)
	QueryRow(ctx context.Context, sql string, args ...any) pgx.Row
	Exec(ctx context.Context, sql string, args ...any) (pgconn.CommandTag, error)
}

Querier abstracts *pgxpool.Pool for testing with pgxmock.

Jump to

Keyboard shortcuts

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