psql

package
v1.27.0 Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2025 License: Apache-2.0 Imports: 12 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package psql implements the `kubectl cnpg psql` command

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewCmd

func NewCmd() *cobra.Command

NewCmd creates the "psql" command

Types

type Command added in v1.21.4

type Command struct {
	CommandOptions
	// contains filtered or unexported fields
}

Command is the launcher of `psql` with `kubectl exec`

func NewCommand added in v1.21.4

func NewCommand(
	ctx context.Context,
	options CommandOptions,
) (*Command, error)

NewCommand creates a new psql command

func (*Command) Exec added in v1.21.4

func (psql *Command) Exec() error

Exec replaces the current process with a `kubectl Exec` invocation. This function won't return

func (*Command) Output added in v1.21.4

func (psql *Command) Output() ([]byte, error)

Output starts a psql process inside the target pod and returns its stdout

func (*Command) Run added in v1.21.4

func (psql *Command) Run() error

Run starts a psql process inside the target pod

type CommandOptions added in v1.21.4

type CommandOptions struct {
	// Require a connection to a Replica
	Replica bool

	// The cluster Name
	Name string

	// The Namespace where we're working in
	Namespace string

	// The Context to execute the command
	Context string

	// Whether we should we allocate a TTY for psql
	AllocateTTY bool

	// Whether we should we pass stdin to psql
	PassStdin bool

	// Arguments to pass to psql
	Args []string
}

CommandOptions are the options required to start psql

type ErrMissingPod

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

ErrMissingPod is raised when we can't find a Pod having the desired role

func (*ErrMissingPod) Error

func (err *ErrMissingPod) Error() string

Error implements the error interface

Jump to

Keyboard shortcuts

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