postgresinstances

package
v1.0.21 Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2026 License: AGPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Repo

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

func New

func New(db postgres.DB, encryptor cryptoutil.Encryptor) *Repo

func (*Repo) Delete

func (r *Repo) Delete(ctx context.Context, id uuid.UUID) error

func (*Repo) DeleteOwnedIfUnreferenced

func (r *Repo) DeleteOwnedIfUnreferenced(ctx context.Context, ownerUserID uuid.UUID) error

DeleteOwnedIfUnreferenced removes ownerUserID's owned instance row if no vault postgres database references it — see repository.PostgresInstances.DeleteOwnedIfUnreferenced.

func (*Repo) Exists

func (r *Repo) Exists(ctx context.Context) (bool, error)

func (*Repo) Get

func (*Repo) GetOwned

func (r *Repo) GetOwned(ctx context.Context, userID uuid.UUID) (sql.Null[domain.PostgresInstance], error)

GetOwned returns the instance owned by userID, if any — see repository.PostgresInstances.GetOwned.

func (*Repo) List

func (r *Repo) List(ctx context.Context) ([]domain.PostgresInstance, error)

func (*Repo) PickForUser

func (r *Repo) PickForUser(ctx context.Context, userID uuid.UUID) (domain.PostgresInstance, error)

PickForUser tries userID's owned instance first, falling back to RandomPick's shared admin pool when they have none — see repository.PostgresInstances.PickForUser.

func (*Repo) RandomPick

func (r *Repo) RandomPick(ctx context.Context) (domain.PostgresInstance, error)

func (*Repo) Register

func (r *Repo) Register(
	ctx context.Context, host string, port int, adminDatabase, username string, passwordPlain []byte, sslMode string,
) (uuid.UUID, error)

func (*Repo) RegisterOwned

func (r *Repo) RegisterOwned(
	ctx context.Context, ownerUserID uuid.UUID, host string, port int, adminDatabase, username string,
	passwordPlain []byte, sslMode string,
) (uuid.UUID, error)

RegisterOwned is like Register but stamps owner_user_id — see repository.PostgresInstances.RegisterOwned.

func (*Repo) Update

func (r *Repo) Update(
	ctx context.Context, id uuid.UUID, host string, port int, adminDatabase, username string,
	passwordPlain []byte, sslMode string,
) error

func (*Repo) WithTx

Jump to

Keyboard shortcuts

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