stateful_bun

package
v0.3.4 Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2024 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var InternalStateProtoFormat = format.Protobuf[*protobuf.State]()
View Source
var ResultsStateProtoFormat = format.Protobuf[*protobuf.Results]()

Functions

func NewRepository

func NewRepository(configurations ...runtime.Configuration[Repository]) stateful.Repository

constructor

func TableToState

func TableToState(dbState *StateTable) (stateful.State[structure.Bytes], error)

func WithConnection

func WithConnection(connection runtime_bun.BunConnection) runtime.Configuration[Repository]

configuration

func WithStateTableName

func WithStateTableName(persistenceTableName string) runtime.Configuration[Repository]

Types

type Repository

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

implementation

func (Repository) Get

func (r Repository) Get(ctx context.Context, persistenceId string) (stateful.State[structure.Bytes], error)

func (Repository) GetAll

func (r Repository) GetAll(ctx context.Context, persistenceId []string) (map[string]stateful.State[structure.Bytes], error)

func (Repository) Upsert

func (r Repository) Upsert(ctx context.Context, persistenceId string, s stateful.State[structure.Bytes]) error

func (Repository) UpsertAll

func (r Repository) UpsertAll(ctx context.Context, stateMap map[string]stateful.State[structure.Bytes]) error

type StateTable

type StateTable struct {
	Id                 string `bun:",pk"`
	Internal           []byte
	Results            []byte
	Content            []byte
	CreatedTimestampMs int64
	UpdatedTimestampMs int64
}

func StateToTable

func StateToTable(nextState stateful.State[structure.Bytes]) (*StateTable, error)

Jump to

Keyboard shortcuts

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