PersistEvent(ctx context.Context, event article.Event) error { switch e := event.(type) { case article.Archived: if _, err := r.Conn.ExecContext(ctx, `INSERT INTO article_archivements (article_id, archived_at) VALUE (?, ?)`, e.ArticleID, e.ArchivedAt); err != nil { return errors.New(...) } case ... default: return errors.New(...) } } func (r ArticleRepository) Find(ctx context.Context, id uuid.UUID) (*article.Article, error) { var data articleData if err := r.Conn.GetContext(ctx, data, `SELECT articles.id, .... FROM articles WHERE articles.id = ?`); err != nil { return nil, errors.New(...) } return r.convertToAggregate(data), nil } શͯΛΠϕϯτͱͯ͠ӬଓԽ͢ΔͷͰͳ͘ɺ ϦιʔεͱΠϕϯτͷ྆ํΛ3%#ͷςʔϒϧͰදݱɻ ΠϕϯτͷӬଓԽͱूͷ࠶ߏங͚ͩͰͳ͘ɺ ΫΤϦϞσϧͷߏஙʹ͑ΔΑ͏ʹ ςʔϒϧΛઃܭ͢Δɻ ΠϕϯτछผʹԠͯ͡ߋ৽ܥͷ42-Λൃߦ ϦιʔεͱΠϕϯτ͔ΒूΛ࠶ߏங