Open aligos opened 8 years ago
if you use https://github.com/jinzhu/gorm (which you should) then your resolver would look like:
"organization": &graphql.Field{
Type: organizationType,
Resolve: func(p graphql.ResolveParams) (interface{}, error) {
db := models.GetAdamaDB()
organization := models.Organization{}
db.Where(&models.Organization{ID: p.Source.(models.User).OrganizationID}).Find(&organization)
return organization, nil
},
},
i hope this repo will be todo example with database like postgres