db

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2020 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Asset

func Asset(name string) ([]byte, error)

Asset loads and returns the asset for the given name. It returns an error if the asset could not be found or could not be loaded.

func AssetDir

func AssetDir(name string) ([]string, error)

AssetDir returns the file names below a certain directory embedded in the file by go-bindata. For example if you run go-bindata on data/... and data contains the following hierarchy:

data/
  foo.txt
  img/
    a.png
    b.png

then AssetDir("data") would return []string{"foo.txt", "img"} AssetDir("data/img") would return []string{"a.png", "b.png"} AssetDir("foo.txt") and AssetDir("notexist") would return an error AssetDir("") will return []string{"data"}.

func AssetNames

func AssetNames() []string

AssetNames returns the names of the assets.

Types

type DBTX

type DBTX interface {
	ExecContext(context.Context, string, ...interface{}) (sql.Result, error)
	PrepareContext(context.Context, string) (*sql.Stmt, error)
	QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error)
	QueryRowContext(context.Context, string, ...interface{}) *sql.Row
}

type DeleteSnapshotParams added in v0.8.0

type DeleteSnapshotParams struct {
	Stream     string `json:"stream"`
	SnapshotID string `json:"snapshot_id"`
}

type GetSnapshotPositionParams added in v0.4.0

type GetSnapshotPositionParams struct {
	Stream     string `json:"stream"`
	SnapshotID string `json:"snapshot_id"`
}

type GetSnapshotPositionRow added in v0.4.0

type GetSnapshotPositionRow struct {
	No          int64  `json:"no"`
	ContentType string `json:"content_type"`
	Data        []byte `json:"data"`
}

type LockSubscriberPositionParams added in v0.8.0

type LockSubscriberPositionParams struct {
	Stream       string   `json:"stream"`
	SubscriberID []string `json:"subscriber_id"`
}

type LockSubscriberPositionRow added in v0.8.0

type LockSubscriberPositionRow struct {
	SubscriberID string `json:"subscriber_id"`
	No           int64  `json:"no"`
}

type PoMessage added in v0.8.0

type PoMessage struct {
	ID            int64          `json:"id"`
	Created       time.Time      `json:"created"`
	Stream        string         `json:"stream"`
	No            int64          `json:"no"`
	Grp           string         `json:"grp"`
	ContentType   string         `json:"content_type"`
	Data          []byte         `json:"data"`
	CorrelationID sql.NullString `json:"correlation_id"`
}

contains messages

type PoSnapshot added in v0.8.0

type PoSnapshot struct {
	Created     time.Time `json:"created"`
	Updated     time.Time `json:"updated"`
	Stream      string    `json:"stream"`
	SnapshotID  string    `json:"snapshot_id"`
	No          int64     `json:"no"`
	Data        []byte    `json:"data"`
	ContentType string    `json:"content_type"`
}

snapshot position and data

type PoSubscription added in v0.8.0

type PoSubscription struct {
	Created      time.Time `json:"created"`
	Updated      time.Time `json:"updated"`
	Stream       string    `json:"stream"`
	SubscriberID string    `json:"subscriber_id"`
	No           int64     `json:"no"`
}

position of a stream subscribers

type Queries

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

func New

func New(db DBTX) *Queries

func (*Queries) DeleteSnapshot added in v0.8.0

func (q *Queries) DeleteSnapshot(ctx context.Context, arg DeleteSnapshotParams) error

func (*Queries) GetSnapshotPosition added in v0.4.0

func (q *Queries) GetSnapshotPosition(ctx context.Context, arg GetSnapshotPositionParams) (GetSnapshotPositionRow, error)

func (*Queries) GetStreamPosition added in v0.4.0

func (q *Queries) GetStreamPosition(ctx context.Context, stream string) (int64, error)

func (*Queries) LockSubscriberPosition added in v0.8.0

func (q *Queries) LockSubscriberPosition(ctx context.Context, arg LockSubscriberPositionParams) ([]LockSubscriberPositionRow, error)

func (*Queries) ReadRecordsByGroup added in v0.8.0

func (q *Queries) ReadRecordsByGroup(ctx context.Context, arg ReadRecordsByGroupParams) ([]PoMessage, error)

func (*Queries) ReadRecordsByStream added in v0.8.0

func (q *Queries) ReadRecordsByStream(ctx context.Context, arg ReadRecordsByStreamParams) ([]PoMessage, error)

func (*Queries) SetSubscriberPosition added in v0.4.0

func (q *Queries) SetSubscriberPosition(ctx context.Context, arg SetSubscriberPositionParams) error

func (*Queries) StoreRecord added in v0.8.0

func (q *Queries) StoreRecord(ctx context.Context, arg StoreRecordParams) (PoMessage, error)

func (*Queries) UpdateSnapshot added in v0.8.0

func (q *Queries) UpdateSnapshot(ctx context.Context, arg UpdateSnapshotParams) error

func (*Queries) WithTx

func (q *Queries) WithTx(tx *sql.Tx) *Queries

type ReadRecordsByGroupParams added in v0.8.0

type ReadRecordsByGroupParams struct {
	Grp   string `json:"grp"`
	ID    int64  `json:"id"`
	ID_2  int64  `json:"id_2"`
	Limit int32  `json:"limit"`
}

type ReadRecordsByStreamParams added in v0.8.0

type ReadRecordsByStreamParams struct {
	Stream string `json:"stream"`
	No     int64  `json:"no"`
	No_2   int64  `json:"no_2"`
	Limit  int32  `json:"limit"`
}

type SetSubscriberPositionParams added in v0.4.0

type SetSubscriberPositionParams struct {
	SubscriberID string `json:"subscriber_id"`
	Stream       string `json:"stream"`
	No           int64  `json:"no"`
}

type StoreRecordParams added in v0.8.0

type StoreRecordParams struct {
	Stream        string         `json:"stream"`
	No            int64          `json:"no"`
	Grp           string         `json:"grp"`
	ContentType   string         `json:"content_type"`
	Data          []byte         `json:"data"`
	CorrelationID sql.NullString `json:"correlation_id"`
}

type UpdateSnapshotParams added in v0.8.0

type UpdateSnapshotParams struct {
	Stream      string `json:"stream"`
	SnapshotID  string `json:"snapshot_id"`
	No          int64  `json:"no"`
	ContentType string `json:"content_type"`
	Data        []byte `json:"data"`
}

Jump to

Keyboard shortcuts

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