I am trying to build query step by step which seems successful(using gorm) if I pass the struct(model/schema). But as I (can)have more than 100 tables, it needs to be independent of the struct. So I pass interface as
func QueryBuilder(db *gorm.DB , model interface{},param schemas.Query) interface{}{
db = BuildSelect(db , param.Select)
db = BuildWhere(db , param.Where)
// Everything ok till here but gorm complaints, it needs a slice or struct.
db = BuildWhereOr(db , param.Or).Find(&model)
fmt.Println("after Build")
return model
}
How can I get back results in desired structs/schemas. Any help or workaround is really appreciated