pgstore

package
v0.0.0-...-b8c8fdf Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2023 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MigrateDown

func MigrateDown(sourceURL string, c PasswordConfig, l bool) (uint, error)

MigrateDown carries out database migration applying down migrations. Migrations are loaded from sourceURL directory on the host.

MigrateDown should be expected to result in a version of 0 as it reverts all previous Ups.

* sourceURL - location of the migrations * c - configuration for the database to carry out migration on * l - whether executing locally or on AWS

returns currently active migration version.

func MigrateUp

func MigrateUp(sourceURL string, c PasswordConfig, l bool) (uint, error)

MigrateUp carries out database migration applying up migrations. Migrations are loaded from sourceURL directory on the host.

* sourceURL - location of the migrations * c - configuration for the database to carry out migration on * l - whether executing locally or on AWS

returns currently active migration version.

func NewMigrate

func NewMigrate(sourceURL string, c PasswordConfig, l bool) (*migrate.Migrate, error)

func NewPasswordDB

func NewPasswordDB(c PasswordConfig, local bool) (*sql.DB, error)

NewPasswordDB returns a database handle representing a pool of zero or more underlying connections that authenticate via username and password.

* c - used to configure database connection * local - true if application running locally, false if running on AWS

Types

type PasswordConfig

type PasswordConfig struct {
	Host     string `json:"host"`
	Name     string `json:"name"`
	Password string `json:"password"`
	Port     int    `json:"port"`
	Username string `json:"username"`
}

PasswordConfig database connection details that authenticates via password.

type PostgresStore

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

func New

func New(ds string) *PostgresStore

func (*PostgresStore) Load

func (s *PostgresStore) Load(ctx context.Context, aggregateID store.ID, fromVersion, toVersion int32) (store.Stream, error)

Load the stream of events up to the version specified. When toVersion is 0, all events will be loaded. To start at the beginning, fromVersion should be set to 0

func (*PostgresStore) Save

func (s *PostgresStore) Save(ctx context.Context, aggregate store.Aggregate, records ...store.Record) error

Save the provided serialized records to the store

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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