Documentation ¶
Overview ¶
Package postgres contains an implementation of the storage.Backend backed by postgres.
Index ¶
- func ParseConfig(dsn string) (*pgxpool.Config, error)
- type Backend
- func (backend *Backend) Close() error
- func (backend *Backend) Get(ctx context.Context, recordType, recordID string) (*databroker.Record, error)
- func (backend *Backend) GetOptions(ctx context.Context, recordType string) (*databroker.Options, error)
- func (backend *Backend) Lease(ctx context.Context, leaseName, leaseID string, ttl time.Duration) (acquired bool, err error)
- func (backend *Backend) ListTypes(ctx context.Context) ([]string, error)
- func (backend *Backend) Patch(ctx context.Context, records []*databroker.Record, ...) (uint64, []*databroker.Record, error)
- func (backend *Backend) Put(ctx context.Context, records []*databroker.Record) (serverVersion uint64, err error)
- func (backend *Backend) RegistryServer() registry.RegistryServer
- func (backend *Backend) SetOptions(ctx context.Context, recordType string, options *databroker.Options) error
- func (backend *Backend) Sync(ctx context.Context, recordType string, serverVersion, recordVersion uint64) (storage.RecordStream, error)
- func (backend *Backend) SyncLatest(ctx context.Context, recordType string, expr storage.FilterExpression) (serverVersion, recordVersion uint64, stream storage.RecordStream, err error)
- type Option
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Backend ¶
type Backend struct {
// contains filtered or unexported fields
}
Backend is a storage Backend implemented with Postgres.
func (*Backend) Get ¶
func (backend *Backend) Get( ctx context.Context, recordType, recordID string, ) (*databroker.Record, error)
Get gets a record from the database.
func (*Backend) GetOptions ¶
func (backend *Backend) GetOptions( ctx context.Context, recordType string, ) (*databroker.Options, error)
GetOptions returns the options for the given record type.
func (*Backend) Lease ¶
func (backend *Backend) Lease( ctx context.Context, leaseName, leaseID string, ttl time.Duration, ) (acquired bool, err error)
Lease attempts to acquire a lease for the given name.
func (*Backend) Patch ¶ added in v0.24.0
func (backend *Backend) Patch( ctx context.Context, records []*databroker.Record, fields *fieldmaskpb.FieldMask, ) (uint64, []*databroker.Record, error)
Patch updates specific fields of existing records in Postgres.
func (*Backend) Put ¶
func (backend *Backend) Put( ctx context.Context, records []*databroker.Record, ) (serverVersion uint64, err error)
Put puts a record into Postgres.
func (*Backend) RegistryServer ¶
func (backend *Backend) RegistryServer() registry.RegistryServer
RegistryServer returns a registry.RegistryServer for the backend.
func (*Backend) SetOptions ¶
func (backend *Backend) SetOptions( ctx context.Context, recordType string, options *databroker.Options, ) error
SetOptions sets the options for the given record type.
func (*Backend) Sync ¶
func (backend *Backend) Sync( ctx context.Context, recordType string, serverVersion, recordVersion uint64, ) (storage.RecordStream, error)
Sync syncs the records.
func (*Backend) SyncLatest ¶
func (backend *Backend) SyncLatest( ctx context.Context, recordType string, expr storage.FilterExpression, ) (serverVersion, recordVersion uint64, stream storage.RecordStream, err error)
SyncLatest syncs the latest version of each record.
Click to show internal directories.
Click to hide internal directories.