Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DatabaseSQLConn ¶
type DatabaseSQLConn interface { BeginTx(context.Context, *sql.TxOptions) (*sql.Tx, error) ExecContext(ctx context.Context, query string, args ...any) (sql.Result, error) }
Interface for connections that use database/sql.
type GCOptions ¶
type GCOptions struct { Logger logger.Logger // Query that must atomically update the "last cleanup time" in the metadata table, but only if the garbage collector hasn't run already. // The caller will check the nuber of affected rows. If zero, it assumes that the GC has ran too recently, and will not proceed to delete expired records. // The query receives one parameter that is the last cleanup interval, in milliseconds. UpdateLastCleanupQuery string // Name of the parameter passed to the UpdateLeastCleanupQuery query, to use named parameters (via `sql.Named`). The parameter is the time interval. // If empty, assumes the parameter is positional and not named. // This is ignored when using the pgx querier. UpdateLastCleanupQueryParameterName string // Query that performs the cleanup of all expired rows. DeleteExpiredValuesQuery string // Interval to perfm the cleanup. CleanupInterval time.Duration // Database connection when using pgx. DBPgx PgxConn // Database connection when using database/sql. DBSql DatabaseSQLConn }
type GarbageCollector ¶
func ScheduleGarbageCollector ¶
func ScheduleGarbageCollector(opts GCOptions) (GarbageCollector, error)
Click to show internal directories.
Click to hide internal directories.