datastore

package
v0.0.0-...-34b142b Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2026 License: MIT Imports: 16 Imported by: 1

Documentation

Overview

Code generated from meta collections. DO NOT EDIT.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WaitPostgresAvailable

func WaitPostgresAvailable(lookup environment.Environmenter) error

WaitPostgresAvailable blocks until postgres db is availabe

Types

type FlowPostgres

type FlowPostgres struct {
	Pool *pgxpool.Pool
}

FlowPostgres uses postgres to get the connections.

func NewFlowPostgres

func NewFlowPostgres(lookup environment.Environmenter) (*FlowPostgres, error)

NewFlowPostgres initializes a SourcePostgres.

func (*FlowPostgres) Close

func (p *FlowPostgres) Close()

Close closes the connection pool.

func (*FlowPostgres) Get

func (p *FlowPostgres) Get(ctx context.Context, keys ...dskey.Key) (map[dskey.Key][]byte, error)

Get fetches the keys from postgres.

func (*FlowPostgres) Update

func (p *FlowPostgres) Update(ctx context.Context, updateFn func(map[dskey.Key][]byte, error))

Update listens on pg notify to fetch updates.

type FlowVoteCount

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

FlowVoteCount is a datastore flow for the poll/vote_count value.

func NewFlowVoteCount

func NewFlowVoteCount(lookup environment.Environmenter) *FlowVoteCount

NewFlowVoteCount initializes the object.

func (*FlowVoteCount) Connect

func (s *FlowVoteCount) Connect(ctx context.Context, eventProvider func() (<-chan time.Time, func() bool), errHandler func(error))

Connect creates a connection to the vote service and makes sure, it stays open.

eventProvider is a function that returns a channel. If the connection fails, this function fetches such a channel and waits for a signal before it tries to open a new connection.

func (*FlowVoteCount) Get

func (s *FlowVoteCount) Get(ctx context.Context, keys ...dskey.Key) (map[dskey.Key][]byte, error)

Get is called when a key is not in the cache.

func (*FlowVoteCount) Update

func (s *FlowVoteCount) Update(ctx context.Context, updateFn func(map[dskey.Key][]byte, error))

Update has to be called frequently. It blocks, until there is new data.

type InvalidDataError

type InvalidDataError struct {
	Key   dskey.Key
	Value []byte
}

InvalidDataError is returned, when a key has an invalid value in the database.

func (InvalidDataError) Error

func (err InvalidDataError) Error() string

Directories

Path Synopsis
Code generated from meta-collections.
Code generated from meta-collections.
gen_fields command
This tool generates the code needed for the request object.
This tool generates the code needed for the request object.
Code generated from meta/collections.
Code generated from meta/collections.
Code generated from meta collections.
Code generated from meta collections.
gen_models command
This tool generates the code needed for the request object.
This tool generates the code needed for the request object.
copy_sql command

Jump to

Keyboard shortcuts

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