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 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…