sqlstore

package
v2.13.7 Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2023 License: MIT Imports: 7 Imported by: 0

README

Running tests towards local database

To run the tests locally, you have to spin up a local postgres database, and set environment variables to let the test connect to the database.

Get postgres docker image

docker pull postgres

Run postgres image and forward port to localhost

docker run --name postgres -e POSTGRES_PASSWORD=your_password -p 5432:5432 postgres

Run tests

env PGUSER="postgres" PGPASSWORD="your_password" PGSSLMODE="disable" go test -v

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BySequenceID added in v2.2.0

func BySequenceID(value string) eventsource.QueryOption

func ByTimestamp added in v2.2.0

func ByTimestamp(value int64) eventsource.QueryOption

func ByType added in v2.2.0

func ByType(value string) eventsource.QueryOption

func New

func New(db *sql.DB, tableName string) eventsource.Store

New creates a new event source store.

func WithAscending

func WithAscending() eventsource.QueryOption

WithAscending will set the sorting order to ascending.

func WithDescending

func WithDescending() eventsource.QueryOption

WithDescending will set the sorting order to descending.

func WithLimit

func WithLimit(limit int) eventsource.QueryOption

WithLimit will limit the result.

func WithOffset

func WithOffset(offset int) eventsource.QueryOption

WithOffset will offset the result.

Types

type EventDB added in v2.9.0

type EventDB interface {
	Load(ctx context.Context, query string, args []interface{}) ([]eventsource.Record, error)
	NewTransaction(ctx context.Context, query string, records ...eventsource.Record) (eventsource.StoreTransaction, error)
}

type PGXStore added in v2.12.0

type PGXStore interface {
	eventsource.Store
	WithPostgresNotify() PGXStore
}

func NewPgx added in v2.9.0

func NewPgx(db driver.PgxPool, tableName string) PGXStore

NewPgx creates a new event source store.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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