sqlstore

package
v2.11.0 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2021 License: MIT Imports: 7 Imported by: 0

README

Running tests towards local 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

Connect to postgres database and create events table

docker run -it --rm --link postgres:postgres postgres psql -h postgres -U postgres

Paste contents of schema.sql to create table.

Run tests

env POSTGRES_CONN_STRING="user=postgres password=your_password sslmode=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 NewPgx added in v2.9.0

func NewPgx(db driver.PgxPool, tableName string) eventsource.Store

NewPgx 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)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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