postgresql

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2022 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const NotAPostgresError string = "Not a postgres error"

Variables

This section is empty.

Functions

func EscapeLiteral

func EscapeLiteral(str string) string

func EscapeLiteralWithoutQuotes

func EscapeLiteralWithoutQuotes(str string) string

func EscapeString

func EscapeString(str string) string

func GenPostgresCertFromCA

func GenPostgresCertFromCA(userName string, secretData map[string][]byte) (map[string][]byte, error)

func IgnoreAlreadyExists

func IgnoreAlreadyExists(err error) error

func Intersect

func Intersect(set1, set2 []authv1alpha1.Privilege) []authv1alpha1.Privilege

func IntersectDefinedPrivsWithDB

func IntersectDefinedPrivsWithDB(definedPrivs, dbPrivsMap map[authv1alpha1.Privilege]struct{}) ([]authv1alpha1.Privilege, []authv1alpha1.Privilege)

func IsAlreadyExists

func IsAlreadyExists(err error) bool

func NewPostgresFromConfig

func NewPostgresFromConfig(config *authv1alpha1.Config, userResource *authv1alpha1.User, client common.KubeInterface, logger logr.Logger) common.DatabaseInterface

func ProcessToPostgressError

func ProcessToPostgressError(err error) string

Types

type DBType

type DBType = string
const (
	PostgreSQL  DBType = "PostgreSQL"
	CockroachDB DBType = "CockroachDB"
)

type Postgres

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

func NewPostgres

func NewPostgres(config *PostgresConfig, configResource *authv1alpha1.PostgreSQLConfig, userResource *authv1alpha1.User, client common.KubeInterface, logger logr.Logger) *Postgres

func (*Postgres) Close

func (p *Postgres) Close(ctx context.Context)

func (*Postgres) Connect

func (p *Postgres) Connect(ctx context.Context) error

func (*Postgres) DeleteUser

func (p *Postgres) DeleteUser(ctx context.Context) error

func (*Postgres) ProcessUser

func (p *Postgres) ProcessUser(ctx context.Context) error

type PostgresConfig

type PostgresConfig struct {
	// connConfig *pgx.ConnConfig
	Host                               string
	User                               string
	Password                           string
	Dbname                             string
	Port                               int
	SSLMode                            database.PostgresSSLMode
	SSLCACert, SSLUserCert, SSLUserKey string
}

func NewPostgresConfig

func NewPostgresConfig(host string, port int, user, pass, dbname string, sslmode database.PostgresSSLMode,
	sslCaCert, sslUserCert, sslUserKey string) *PostgresConfig

func (*PostgresConfig) Copy

func (in *PostgresConfig) Copy() *PostgresConfig

func (*PostgresConfig) GetConfig

func (c *PostgresConfig) GetConfig() string

Jump to

Keyboard shortcuts

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