Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
388 views
in Technique[技术] by (71.8m points)

go - From a DDD perspective, how to handle DB specific types

I'm trying to implement DDD in my project and I'm using Firestore as my persistence infrastructure. Firestore in Go has some specific types like *firestore.DocumentRef.

I think that I should put it in my entity struct as it should represent my model, but my entity should also be db agnostic (I think).

So how should I handle from a DDD perspective this entity/struct:

type Holder struct {
    SocialReason       string                 `firestore:"social_reason" json:"social_reason"`
    Contact            value.Contact          `firestore:"contact" json:"contact"`
    Location           value.Location         `firestore:"location" json:"location"`
    SubmissionDatetime time.Time              `firestore:"submission_datetime" json:"-"`
    UpdateDatetime     time.Time              `firestore:"update_datetime" json:"-"`
    Status             string                 `firestore:"status" json:"status"`
    LastModifier       *firestore.DocumentRef `firestore:"last_modifier" json:"-"`
    CEP                string                 `firestore:"cep,omitempty" json:"cep,omitempty"`
    Country            string                 `firestore:"country" json:"country"`
    Region             string                 `firestore:"region,omitempty" json:"region,omitempty"`
    City               string                 `firestore:"city,omitempty" json:"city,omitempty"`
}
question from:https://stackoverflow.com/questions/65903156/from-a-ddd-perspective-how-to-handle-db-specific-types

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...