postgres

package
v4.0.0 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2025 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AdvisoryLock

type AdvisoryLock interface {
	Lock() (bool, error)
	Unlock() (bool, error)
	LockShared() (bool, error)
	UnlockShared() (bool, error)
}

func NewAdvisoryLock

func NewAdvisoryLock(connPool *pgxpool.Pool, logger logger.LoggingClient, serviceKey string) (AdvisoryLock, error)

NewAdvisoryLock creates a new instance with specified lock ID, and connection pool.

type Client

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

func NewClient

func NewClient(ctx context.Context, config bootstrapConfig.Database, credentials bootstrapConfig.Credentials,
	lc logger.LoggingClient, serviceKey string) (*Client, errors.EdgeX)

NewClient returns a pointer to the Postgres client

func (Client) CloseSession

func (c Client) CloseSession()

CloseSession closes the connections to postgres

func (Client) Disconnect

func (c Client) Disconnect() error

Disconnect ends the connection.

func (Client) RemoveFromStore

func (c Client) RemoveFromStore(o interfaces.StoredObject) error

RemoveFromStore removes an object from the store table by StoredObject ID

func (Client) RetrieveFromStore

func (c Client) RetrieveFromStore(appServiceKey string) ([]interfaces.StoredObject, error)

RetrieveFromStore gets an object from the table with content column contains the appServiceKey

func (Client) Store

func (c Client) Store(o interfaces.StoredObject) (string, error)

Store persists a stored object to the store table and returns the assigned UUID

func (Client) Update

func (c Client) Update(o interfaces.StoredObject) error

Update replaces the data currently in the store table by the StoredObject ID

type TableManager

type TableManager interface {
	RunScripts(ctx context.Context) error
}

TableManager defines the interface for the table manager

func NewTableManager

func NewTableManager(connPool *pgxpool.Pool, lc logger.LoggingClient, schemaName, serviceKey, version string, sqlFiles embed.FS) (TableManager, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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