journal

package
v0.0.0-...-b08fcc5 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	DefaultMongoDBDatabase   = "journal"
	DefaultMongoDBCollection = "collection"
)

Defaults

Variables

This section is empty.

Functions

func NewJournal

func NewJournal(opts ...Option)

NewJournal create journal writer

Types

type Journal

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

Journal : ...

func (*Journal) Append

func (j *Journal) Append(ctx context.Context, r *Record) error

Append record to journal

type Option

type Option func(o *Options)

Option : ...

func SetMongoDBClient

func SetMongoDBClient(client *mongo.Client) Option

SetMongoDBClient set mongodb connector

func SetMongoDBCollection

func SetMongoDBCollection(database, collection string) Option

SetMongoDBCollection set database & collection

func SetName

func SetName(name string) Option

SetName sets journal name

func SetRedisClient

func SetRedisClient(rdb *redis.Client) Option

SetRedisClient set redis client

type Options

type Options struct {
	Name string

	// May not user
	Backend StorageBackend
	// contains filtered or unexported fields
}

Options : Journal options

type Record

type Record struct {
	TS    time.Time
	Event string
	Data  interface{}
}

Record : Journal record

type StorageBackend

type StorageBackend int8

StorageBackend : Enum of backend

const (
	GORMBackend    StorageBackend = 0
	MongoDBBackend StorageBackend = 1
)

Backends

Jump to

Keyboard shortcuts

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