Documentation ¶
Overview ¶
Package postgres implements the target storage interface backed by PostgreSQL.
Index ¶
- type Client
- func (c *Client) Begin(ctx context.Context) (storage.Tx, error)
- func (c *Client) Close()
- func (c *Client) DisableTriggersAndFKConstraints(ctx context.Context) error
- func (c *Client) EnableTriggersAndFKConstraints(ctx context.Context) error
- func (c *Client) Name() string
- func (c *Client) Query(ctx context.Context, sql string, args ...interface{}) (pgx.Rows, error)
- func (c *Client) QueryRow(ctx context.Context, sql string, args ...interface{}) pgx.Row
- func (c *Client) SendBatch(ctx context.Context, batch *storage.QueryBatch) error
- func (c *Client) SendBatchWithOptions(ctx context.Context, batch *storage.QueryBatch, opts pgx.TxOptions) error
- func (c *Client) Wipe(ctx context.Context) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is a client for connecting to PostgreSQL.
func (*Client) Close ¶
func (c *Client) Close()
Close implements the storage.TargetStorage interface for Client.
func (*Client) DisableTriggersAndFKConstraints ¶
DisableTriggersAndFKConstraints disables all triggers and foreign key constraints in nexus tables. This is useful when inserting blockchain data out of order, so that later blocks can refer to (yet unindexed) earlier blocks without violating constraints.
func (*Client) EnableTriggersAndFKConstraints ¶
EnableTriggersAndFKConstraints enables all triggers and foreign key constraints in the given schema. WARNING: This might enable triggers not explicitly disabled by DisableTriggersAndFKConstraints. WARNING: This does not enforce/check contraints on rows that were inserted while triggers were disabled.
func (*Client) SendBatch ¶
SendBatch submits a new batch of queries as an atomic transaction to PostgreSQL.
For now, updated row counts are discarded as this is not intended to be used by any nexus. We only care about atomic success or failure of the batch of queries corresponding to a new block.