psql

package
v1.23.0 Latest Latest
Warning

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

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

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

	// 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