Documentation ¶
Index ¶
- type DefaultSchema
- func (d *DefaultSchema) ActorName() string
- func (d *DefaultSchema) CreateTable() []string
- func (d *DefaultSchema) Created() string
- func (d *DefaultSchema) ID() string
- func (d *DefaultSchema) JournalTableName() string
- func (d *DefaultSchema) Payload() string
- func (d *DefaultSchema) SequenceNumber() string
- func (d *DefaultSchema) SnapshotTableName() string
- func (d *DefaultSchema) WithJournalTable(name string) *DefaultSchema
- func (d *DefaultSchema) WithSnapshotTable(name string) *DefaultSchema
- type Provider
- func (provider *Provider) DeleteEvents(_ string, _ int)
- func (provider *Provider) DeleteSnapshots(_ string, _ int)
- func (provider *Provider) GetEvents(actorName string, eventIndexStart int, eventIndexEnd int, ...)
- func (provider *Provider) GetSnapshot(actorName string) (snapshot interface{}, eventIndex int, ok bool)
- func (provider *Provider) GetSnapshotInterval() int
- func (provider *Provider) GetState() persistence.ProviderState
- func (provider *Provider) PersistEvent(actorName string, eventIndex int, snapshot proto.Message)
- func (provider *Provider) PersistSnapshot(actorName string, eventIndex int, snapshot proto.Message)
- func (provider *Provider) Restart()
- type Schemaer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DefaultSchema ¶
type DefaultSchema struct {
// contains filtered or unexported fields
}
DefaultSchema is the default implementation of the Schemaer interface.
func NewTable ¶
func NewTable() *DefaultSchema
func (*DefaultSchema) ActorName ¶
func (d *DefaultSchema) ActorName() string
ActorName returns the name of the actor name column.
func (*DefaultSchema) CreateTable ¶
func (d *DefaultSchema) CreateTable() []string
CreateTable returns the sql statement to create the table.
func (*DefaultSchema) Created ¶
func (d *DefaultSchema) Created() string
Created returns the name of the created at column.
func (*DefaultSchema) ID ¶
func (d *DefaultSchema) ID() string
ID returns the name of the id column.
func (*DefaultSchema) JournalTableName ¶
func (d *DefaultSchema) JournalTableName() string
JournalTableName returns the name of the journal table.
func (*DefaultSchema) Payload ¶
func (d *DefaultSchema) Payload() string
Payload returns the name of the payload column.
func (*DefaultSchema) SequenceNumber ¶
func (d *DefaultSchema) SequenceNumber() string
SequenceNumber returns the name of the sequence number column.
func (*DefaultSchema) SnapshotTableName ¶
func (d *DefaultSchema) SnapshotTableName() string
SnapshotTableName returns the name of the snapshot table.
func (*DefaultSchema) WithJournalTable ¶
func (d *DefaultSchema) WithJournalTable(name string) *DefaultSchema
WithJournalTable sets the name of the journal table.
func (*DefaultSchema) WithSnapshotTable ¶
func (d *DefaultSchema) WithSnapshotTable(name string) *DefaultSchema
WithSnapshotTable sets the name of the snapshot table.
type Provider ¶
type Provider struct {
// contains filtered or unexported fields
}
Provider is the abstraction used for persistence
func New ¶
func New(ctx context.Context, snapshotInterval int, table Schemaer, db *pgxpool.Pool, logger *slog.Logger) (*Provider, error)
New creates a new pg provider
func (*Provider) DeleteEvents ¶
DeleteEvents removes all events from the provider
func (*Provider) DeleteSnapshots ¶
func (*Provider) GetEvents ¶
func (provider *Provider) GetEvents(actorName string, eventIndexStart int, eventIndexEnd int, callback func(e interface{}))
GetEvents retrieves events from the provider eventIndexEnd 0 means max see https://github.com/asynkron/protoactor-go/blob/dev/persistence/plugin.go#L65
func (*Provider) GetSnapshot ¶
func (*Provider) GetSnapshotInterval ¶
func (*Provider) GetState ¶
func (provider *Provider) GetState() persistence.ProviderState
func (*Provider) PersistEvent ¶
func (*Provider) PersistSnapshot ¶
type Schemaer ¶
type Schemaer interface { // JournalTableName returns the name of the journal table. JournalTableName() string // SnapshotTableName returns the name of the snapshot table. SnapshotTableName() string // ID returns the name of the id column. ID() string // Payload returns the name of the payload column. Payload() string // ActorName returns the name of the actor name column. ActorName() string // SequenceNumber returns the name of the sequence number column. SequenceNumber() string // Created returns the name of the created at column. Created() string // CreateTable returns the sql statement to create the table. CreateTable() []string }
Schemaer is the interface that wraps the basic methods for a schema.