mysql

package
v0.26.0 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package mysql implements secret persistence for MySQL databases. It uses binary UUID marshalling for MySQL compatibility.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MySQLSecretRepository

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

MySQLSecretRepository implements Secret persistence for MySQL databases.

func NewMySQLSecretRepository

func NewMySQLSecretRepository(db *sql.DB) *MySQLSecretRepository

NewMySQLSecretRepository creates a new MySQL Secret repository instance.

func (*MySQLSecretRepository) Create

Create inserts a new secret into the MySQL database.

func (*MySQLSecretRepository) Delete

func (m *MySQLSecretRepository) Delete(ctx context.Context, path string) error

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

func (*MySQLSecretRepository) GetByPath

func (m *MySQLSecretRepository) GetByPath(
	ctx context.Context,
	path string,
) (*secretsDomain.Secret, error)

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

func (*MySQLSecretRepository) GetByPathAndVersion

func (m *MySQLSecretRepository) 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 (*MySQLSecretRepository) HardDelete added in v0.25.0

func (m *MySQLSecretRepository) 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 (*MySQLSecretRepository) List

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

List retrieves secrets ordered by path ascending with pagination.

func (*MySQLSecretRepository) ListCursor added in v0.25.0

func (m *MySQLSecretRepository) 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