housekeeper

package
v0.9.6 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2025 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

Package housekeeper provides functionality for managing and maintaining database tables with specific conditions and retention policies.

The package defines a Table structure to represent a database table along with its associated metadata, such as timestamp and date columns, a condition for filtering rows, and a minimum retention period in days.

It also provides a thread-safe mechanism to register and manage tables using a global map protected by a mutex.

Index

Constants

View Source
const DefaultRetentionDays = 30

Variables

View Source
var Module = fx.Module("db_housekeeper",
	fx.Provide(
		New,
	),
)

Functions

func AddTable

func AddTable(tbl *Table)

Types

type Housekeeper

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

func New

func New(p Params) *Housekeeper

type Params

type Params struct {
	fx.In

	LC fx.Lifecycle

	Logger *zap.Logger
	DB     *sql.DB
	TP     *tracesdk.TracerProvider

	Cron         croner.ICron
	CronHandlers *croner.Handlers
}

type Table

type Table struct {
	Table           jet.Table
	TimestampColumn jet.ColumnTimestamp
	DateColumn      jet.ColumnDate
	Condition       jet.BoolExpression
	MinDays         int
}

Jump to

Keyboard shortcuts

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