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 ¶
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.