mirror of
https://github.com/pomerium/pomerium.git
synced 2025-04-29 10:26:29 +02:00
* wip * storage: add filtering to SyncLatest * don't increment the record version, so intermediate changes are requested * databroker: add support for query filtering * fill server and record version * postgres: databroker storage backend * wip * serialize puts * add test * skip tests for macos * add test * return error from protojson * set data * exclude postgres from cover tests
30 lines
478 B
Go
30 lines
478 B
Go
package postgres
|
|
|
|
import (
|
|
"time"
|
|
)
|
|
|
|
const defaultExpiry = time.Hour * 24
|
|
|
|
type config struct {
|
|
expiry time.Duration
|
|
}
|
|
|
|
// Option customizes a Backend.
|
|
type Option func(*config)
|
|
|
|
// WithExpiry sets the expiry for changes.
|
|
func WithExpiry(expiry time.Duration) Option {
|
|
return func(cfg *config) {
|
|
cfg.expiry = expiry
|
|
}
|
|
}
|
|
|
|
func getConfig(options ...Option) *config {
|
|
cfg := new(config)
|
|
WithExpiry(defaultExpiry)(cfg)
|
|
for _, o := range options {
|
|
o(cfg)
|
|
}
|
|
return cfg
|
|
}
|