mysqlstore

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MySQLStore

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

MySQLStore is a database-backed implementation of the Store interface. It uses a single MySQL table to persist and manage aggregate records.

func NewMySQLStore

func NewMySQLStore(db *sql.DB, snapshotInterval int64) *MySQLStore

NewMySQLStore initializes and returns a new instance of MySQLStore. It receives an open `sql.DB` connection and an optional snapshot interval.

func (*MySQLStore) Load

func (m *MySQLStore) Load(ctx context.Context, aggregateId string) (*historyv1.History, error)

Load retrieves the history for a given aggregate ID from the database. If no history exists for the specified ID, an empty History object is returned.

func (*MySQLStore) Save

func (m *MySQLStore) Save(ctx context.Context, aggregateId string, records ...*recordv1.Record) error

Save persists a list of records for a given aggregate ID in the database. If any record conflicts (e.g., duplicate aggregate ID and version), an error is returned.

func (*MySQLStore) SnapshotInterval

func (m *MySQLStore) SnapshotInterval() int64

SnapshotInterval returns the configured snapshot interval.

Jump to

Keyboard shortcuts

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