repository

package
v0.29.0 Latest Latest
Warning

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

Go to latest
Published: May 27, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package repository implements data persistence for secret management. Repositories use PostgreSQL with automatic versioning and soft deletion.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type SecretRepository added in v0.29.0

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

SecretRepository implements Secret persistence for PostgreSQL databases.

func NewSecretRepository added in v0.29.0

func NewSecretRepository(db *sql.DB) *SecretRepository

NewSecretRepository creates a new PostgreSQL Secret repository instance.

func (*SecretRepository) Create added in v0.29.0

func (p *SecretRepository) Create(ctx context.Context, secret *secretsDomain.Secret) error

Create inserts a new secret into the PostgreSQL database.

func (*SecretRepository) Delete added in v0.29.0

func (p *SecretRepository) Delete(ctx context.Context, path string) error

Delete performs a soft delete on all versions of a secret by path.

func (*SecretRepository) GetByPath added in v0.29.0

func (p *SecretRepository) GetByPath(
	ctx context.Context,
	path string,
) (*secretsDomain.Secret, error)

GetByPath retrieves the latest non-deleted version of a secret by its path.

func (*SecretRepository) GetByPathAndVersion added in v0.29.0

func (p *SecretRepository) GetByPathAndVersion(
	ctx context.Context,
	path string,
	version uint,
) (*secretsDomain.Secret, error)

GetByPathAndVersion retrieves a specific version of a secret by its path and version number.

func (*SecretRepository) HardDelete added in v0.29.0

func (p *SecretRepository) HardDelete(
	ctx context.Context,
	olderThan time.Time,
	dryRun bool,
) (int64, error)

HardDelete permanently removes soft-deleted secrets older than the specified time. Only affects secrets where deleted_at IS NOT NULL. If dryRun is true, returns count without performing deletion. Returns the number of secrets that were (or would be) deleted.

func (*SecretRepository) List added in v0.29.0

func (p *SecretRepository) List(
	ctx context.Context,
	offset, limit int,
) ([]*secretsDomain.Secret, error)

List retrieves secrets ordered by path ascending with pagination.

func (*SecretRepository) ListCursor added in v0.29.0

func (p *SecretRepository) ListCursor(
	ctx context.Context,
	afterPath *string,
	limit int,
) ([]*secretsDomain.Secret, error)

ListCursor retrieves secrets ordered by path ascending using cursor-based pagination.

Jump to

Keyboard shortcuts

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