Building 70 Projects ranging from beginner to advanced so anyone can — learn from, build upon, use as a reference, or even copy directly. Owned by my cybersecurity company 👇
Go aicertificationcloud-engineeringcybercybersecuritycybersecurity-analystcybersecurity-certificationcybersecurity-certificationscybersecurity-educationcybersecurity-jobscybersecurity-portfoliocybersecurity-projectscybersecurity-toolsgrchackinglearningpentestingproject-repositoryprojetcspython
// ©AngelaMos | 2026
// persister.go
package snapshot
import (
"context"
"encoding/json"
"fmt"
"github.com/carterperez-dev/monitor-the-situation/backend/internal/events"
)
type StorePersister struct {
Store *Store
}
func (s StorePersister) Save(ctx context.Context, ev events.Event) error {
raw, err := json.Marshal(ev.Payload)
if err != nil {
return fmt.Errorf("marshal payload: %w", err)
}
if ev.Topic == events.TopicCoinbasePrice {
return s.Store.MergeSymbolMap(ctx, ev.Topic, raw)
}
return s.Store.PutLatest(ctx, ev.Topic, raw)
}