Documentation
¶
Overview ¶
Package repository implements data persistence for secret management. Repositories support both PostgreSQL and MySQL with automatic versioning and soft deletion.
Index ¶
- type PostgreSQLSecretRepository
- func (p *PostgreSQLSecretRepository) Create(ctx context.Context, secret *secretsDomain.Secret) error
- func (p *PostgreSQLSecretRepository) Delete(ctx context.Context, path string) error
- func (p *PostgreSQLSecretRepository) GetByPath(ctx context.Context, path string) (*secretsDomain.Secret, error)
- func (p *PostgreSQLSecretRepository) GetByPathAndVersion(ctx context.Context, path string, version uint) (*secretsDomain.Secret, error)
- func (p *PostgreSQLSecretRepository) HardDelete(ctx context.Context, olderThan time.Time, dryRun bool) (int64, error)
- func (p *PostgreSQLSecretRepository) List(ctx context.Context, offset, limit int) ([]*secretsDomain.Secret, error)
- func (p *PostgreSQLSecretRepository) ListCursor(ctx context.Context, afterPath *string, limit int) ([]*secretsDomain.Secret, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type PostgreSQLSecretRepository ¶
type PostgreSQLSecretRepository struct {
// contains filtered or unexported fields
}
PostgreSQLSecretRepository implements Secret persistence for PostgreSQL databases.
func NewPostgreSQLSecretRepository ¶
func NewPostgreSQLSecretRepository(db *sql.DB) *PostgreSQLSecretRepository
NewPostgreSQLSecretRepository creates a new PostgreSQL Secret repository instance.
func (*PostgreSQLSecretRepository) Create ¶
func (p *PostgreSQLSecretRepository) Create(ctx context.Context, secret *secretsDomain.Secret) error
Create inserts a new secret into the PostgreSQL database.
func (*PostgreSQLSecretRepository) Delete ¶
func (p *PostgreSQLSecretRepository) Delete(ctx context.Context, path string) error
Delete performs a soft delete on all versions of a secret by path.
func (*PostgreSQLSecretRepository) GetByPath ¶
func (p *PostgreSQLSecretRepository) GetByPath( ctx context.Context, path string, ) (*secretsDomain.Secret, error)
GetByPath retrieves the latest non-deleted version of a secret by its path.
func (*PostgreSQLSecretRepository) GetByPathAndVersion ¶
func (p *PostgreSQLSecretRepository) 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 (*PostgreSQLSecretRepository) HardDelete ¶ added in v0.25.0
func (p *PostgreSQLSecretRepository) 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 (*PostgreSQLSecretRepository) List ¶
func (p *PostgreSQLSecretRepository) List( ctx context.Context, offset, limit int, ) ([]*secretsDomain.Secret, error)
List retrieves secrets ordered by path ascending with pagination.
func (*PostgreSQLSecretRepository) ListCursor ¶ added in v0.25.0
func (p *PostgreSQLSecretRepository) ListCursor( ctx context.Context, afterPath *string, limit int, ) ([]*secretsDomain.Secret, error)
ListCursor retrieves secrets ordered by path ascending using cursor-based pagination.