Clean Architecture in Go - Dynamic Projection

85 views
Skip to first unread message

Sarath Prabath Redlapalli Jaya

unread,
Aug 13, 2020, 12:58:54 PM8/13/20
to golang-nuts
Hi All,

We've a complex and nested Domain Object User

type User struct {
Profile *Profile
// ......
// ......
}

stored in a SQL database as 
id, user_name, email, image(Profile), category(Profile)

Using Clean Architecture by having SQL Database behind an interface, how can we best implement querying dynamic set of fields?
1. If we use database column names inside Service layer, it violates Clean Architecture
2. To maintain the integrity of these layers, we might need to use reflection to figure out the column name? or is there any better way to achieve it using code generation?

Regards
Reply all
Reply to author
Forward
0 new messages