Created
June 14, 2020 17:54
-
-
Save bmonkman/b5fa8ba07c9bdeec1710e86677a1ab8d to your computer and use it in GitHub Desktop.
resolver.go
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package resolvers | |
import ( | |
"context" | |
"github.com/commitdev/myapp/internal/database" | |
"github.com/commitdev/myapp" | |
) | |
func (r *queryResolver) User(ctx context.Context, id string) (*models.User, error) { | |
// Load a user out of our DB. Remember that in gqlgen.yml we mapped this model to an existing struct | |
user, err := myapp.User.One(id, database.GetConn(ctx)) | |
if err != nil { | |
return nil, err | |
} | |
return &user, err | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment