pg

package
v0.4.5 Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2022 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package pg implements a blob store in a Postgresql relational database schema.

Index

Constants

View Source
const Schema = `` /* 232-byte string literal not displayed */

Schema is the SQL that New executes. It creates the `blobs` and `anchors` tables if they do not exist. (If they do exist, they must have the columns, constraints, and indexing described here.)

Variables

This section is empty.

Functions

This section is empty.

Types

type Store

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

Store is a Postgresql-based blob store.

func New

func New(ctx context.Context, db *sql.DB) (*Store, error)

New produces a new Store using `db` for storage.

func (*Store) AnchorMapRef

func (s *Store) AnchorMapRef(ctx context.Context) (bs.Ref, error)

AnchorMapRef implements anchor.Getter.

func (*Store) Get

func (s *Store) Get(ctx context.Context, ref bs.Ref) (bs.Blob, error)

Get gets the blob with hash `ref`.

func (*Store) ListRefs

func (s *Store) ListRefs(ctx context.Context, start bs.Ref, f func(bs.Ref) error) error

ListRefs produces all blob refs in the store, in lexicographic order.

func (*Store) Put

func (s *Store) Put(ctx context.Context, b bs.Blob) (bs.Ref, bool, error)

Put adds a blob to the store if it wasn't already present.

func (*Store) UpdateAnchorMap

func (s *Store) UpdateAnchorMap(ctx context.Context, f anchor.UpdateFunc) error

UpdateAnchorMap implements anchor.Store.

Jump to

Keyboard shortcuts

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