Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // DefaultEraseInterval is default interval for next iteration // of erasing old data. DefaultEraseInterval = 24 * time.Hour // DefaultRetentionWindow is the interval of days that will // not be deleted. All data older than current number of days // will be deleted. DefaultRetentionWindow = 60 )
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
// Interval for the next iteratin of erasing old data.
//
// Optional. By default: DefaultEraseInterval.
EraseInterval time.Duration
// The data older then current number of days will be deleted
// at the next iteration.
//
// Optional. Default: DefaultRetentionWindow.
RetentionWindowDays int
// Callback to handle an error if one occurs while erasing data.
//
// Optional.
ErrorCallback func(err error)
}
type Policy ¶
type Policy struct {
// contains filtered or unexported fields
}
Policy is a structure that deletes data older than specified interval. This is useful if we do not need to keep all old data all the time.
func NewPolicy ¶
NewPolicy creates new Policy to erasing old data at the specified table. The specified table must contain a `created_at` field otherwise the structure will not work.
Arguments.
conn - connection to the database we need to interact with. tableName - the name of the table in which we need to save the data window only. config - optional configuration of retention policy.
Click to show internal directories.
Click to hide internal directories.