{"action":"created","comment":{"url":"https://api.github.com/repos/choonkeat/hellocrud/pulls/comments/181432445","pull_request_review_id":112064143,"id":181432445,"diff_hunk":"@@ -1,27 +1,48 @@\n+{{- $dot := . -}}\n {{- $tableNameSingular := .Table.Name | singular -}}\n {{- $modelName := $tableNameSingular | titleCase -}}\n+{{- $modelNamePlural := .Table.Name | plural | titleCase -}}\n {{- $modelNameCamel := $tableNameSingular | camelCase}}\n {{- $pkColDefs := sqlColDefinitions .Table.Columns .Table.PKey.Columns}}\n \n-// {{$modelName}}sCollection is the struct representing a collection of GraphQL types\n-type {{$modelName}}sCollection struct {\n+// {{$modelNamePlural}}Collection is the struct representing a collection of GraphQL types\n+type {{$modelNamePlural}}Collection struct {\n \tnodes []{{$modelName}}\n \t// future meta data goes here, e.g. count\n }\n \n // Nodes returns the list of GraphQL types\n-func (c {{$modelName}}sCollection) Nodes(ctx context.Context) []{{$modelName}} {\n+func (c {{$modelNamePlural}}Collection) Nodes(ctx context.Context) []{{$modelName}} {\n \treturn c.nodes\n }\n \n-// All{{$modelName}}s retrieves {{$modelName}}s based on the provided search parameters\n-func (r *Resolver) All{{$modelName}}s(ctx context.Context, args struct {\n+// All{{$modelNamePlural}} retrieves {$modelNamePlural}} based on the provided search parameters\n+func (r *Resolver) All{{$modelNamePlural}}(ctx context.Context, args struct {\n \tSince    *graphql.ID\n \tPageSize int32\n \tSearch *search{{$modelName}}Args\n-}) ({{$modelName}}sCollection, error) {\n-\tresult := {{$modelName}}sCollection{}\n-\tmods := []qm.QueryMod{qm.Limit(int(args.PageSize))}\n+}) ({{$modelNamePlural}}Collection, error) {\n+\tresult := {{$modelNamePlural}}Collection{}\n+\tmods := []qm.QueryMod{\n+\t\tqm.Limit(int(args.PageSize)),\n+\t\t// TODO: Add eager loading based on requested fields\n+\t\t{{/* Add eager loaders on FK relationships */}}\n+\t\t{{- range .Table.FKeys -}}\n+\t\t{{- $txt := txtsFromFKey $dot.Tables $dot.Table . -}}\n+\t\tqm.Load(\"{{$txt.Function.Name}}\"),","path":"golang/sqlboiler/templates/10_resolver.tpl","position":40,"original_position":40,"commit_id":"6d27e9e6808dbc4cc64b584cfdc21a2b8381eb8f","original_commit_id":"6d27e9e6808dbc4cc64b584cfdc21a2b8381eb8f","user":{"login":"severedsea","id":5338851,"avatar_url":"https://avatars2.githubusercontent.com/u/5338851?v=4","gravatar_id":"","url":"https://api.github.com/users/severedsea","html_url":"https://github.com/severedsea","followers_url":"https://api.github.com/users/severedsea/followers","following_url":"https://api.github.com/users/severedsea/following{/other_user}","gists_url":"https://api.github.com/users/severedsea/gists{/gist_id}","starred_url":"https://api.github.com/users/severedsea/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/severedsea/subscriptions","organizations_url":"https://api.github.com/users/severedsea/orgs","repos_url":"https://api.github.com/users/severedsea/repos","events_url":"https://api.github.com/users/severedsea/events{/privacy}","received_events_url":"https://api.github.com/users/severedsea/received_events","type":"User","site_admin":false},"body":"`qm.Load(\"{{template variable}}\")` - Template variable is based on how the eager functions are being generated. Please see: \r\nhttps://github.com/volatiletech/sqlboiler/blob/7e0eca627f995e2476d637ada0c3b70ecb5d837c/templates/08_relationship_one_to_one_eager.tpl#L10\r\nhttps://github.com/volatiletech/sqlboiler/blob/7e0eca627f995e2476d637ada0c3b70ecb5d837c/queries/eager_load.go#L68","created_at":"2018-04-13T15:52:08Z","updated_at":"2018-04-13T15:53:33Z","html_url":"https://github.com/choonkeat/hellocrud/pull/8#discussion_r181432445","pull_request_url":"https://api.github.com/repos/choonkeat/hellocrud/pulls/8","author_association":"COLLABORATOR","_links":{"self":{"href":"https://api.github.com/repos/choonkeat/hellocrud/pulls/comments/181432445"},"html":{"href":"https://github.com/choonkeat/hellocrud/pull/8#discussion_r181432445"},"pull_request":{"href":"https://api.github.com/repos/choonkeat/hellocrud/pulls/8"}}},"pull_request":{"url":"https://api.github.com/repos/choonkeat/hellocrud/pulls/8","id":181526202,"html_url":"https://github.com/choonkeat/hellocrud/pull/8","diff_url":"https://github.com/choonkeat/hellocrud/pull/8.diff","patch_url":"https://github.com/choonkeat/hellocrud/pull/8.patch","issue_url":"https://api.github.com/repos/choonkeat/hellocrud/issues/8","number":8,"state":"open","locked":false,"title":"[feature] Add eager loading and relationship resolvers","user":{"login":"severedsea","id":5338851,"avatar_url":"https://avatars2.githubusercontent.com/u/5338851?v=4","gravatar_id":"","url":"https://api.github.com/users/severedsea","html_url":"https://github.com/severedsea","followers_url":"https://api.github.com/users/severedsea/followers","following_url":"https://api.github.com/users/severedsea/following{/other_user}","gists_url":"https://api.github.com/users/severedsea/gists{/gist_id}","starred_url":"https://api.github.com/users/severedsea/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/severedsea/subscriptions","organizations_url":"https://api.github.com/users/severedsea/orgs","repos_url":"https://api.github.com/users/severedsea/repos","events_url":"https://api.github.com/users/severedsea/events{/privacy}","received_events_url":"https://api.github.com/users/severedsea/received_events","type":"User","site_admin":false},"body":"### Summary \r\n- Add eager loading to help avoid n+1/optimise query for simple joins. Currently, it's just _eager loading_ all relationships, but can be further improved once the PR in https://github.com/graph-gophers/graphql-go/ that makes requested fields available on resolvers are merged. Please see issues/17, pull/70, and pull/169 for reference.\r\n- Added relationship resolvers (schema + implementation) \r\n- Refactored the way plural names are being derived to be consistent with the default boiler templates (https://github.com/volatiletech/sqlboiler/blob/05d901865aad7a4f0e93771ec51efc18ee920a05/templates/13_all.tpl#L9) \r\n\r\n\r\n","created_at":"2018-04-13T15:43:48Z","updated_at":"2018-04-13T15:53:33Z","closed_at":null,"merged_at":null,"merge_commit_sha":"f846315af58b248d1b1621ecf8be8c08aad4fafd","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/choonkeat/hellocrud/pulls/8/commits","review_comments_url":"https://api.github.com/repos/choonkeat/hellocrud/pulls/8/comments","review_comment_url":"https://api.github.com/repos/choonkeat/hellocrud/pulls/comments{/number}","comments_url":"https://api.github.com/repos/choonkeat/hellocrud/issues/8/comments","statuses_url":"https://api.github.com/repos/choonkeat/hellocrud/statuses/6d27e9e6808dbc4cc64b584cfdc21a2b8381eb8f","head":{"label":"choonkeat:feature/eager_loading","ref":"feature/eager_loading","sha":"6d27e9e6808dbc4cc64b584cfdc21a2b8381eb8f","user":{"login":"choonkeat","id":473,"avatar_url":"https://avatars3.githubusercontent.com/u/473?v=4","gravatar_id":"","url":"https://api.github.com/users/choonkeat","html_url":"https://github.com/choonkeat","followers_url":"https://api.github.com/users/choonkeat/followers","following_url":"https://api.github.com/users/choonkeat/following{/other_user}","gists_url":"https://api.github.com/users/choonkeat/gists{/gist_id}","starred_url":"https://api.github.com/users/choonkeat/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/choonkeat/subscriptions","organizations_url":"https://api.github.com/users/choonkeat/orgs","repos_url":"https://api.github.com/users/choonkeat/repos","events_url":"https://api.github.com/users/choonkeat/events{/privacy}","received_events_url":"https://api.github.com/users/choonkeat/received_events","type":"User","site_admin":false},"repo":{"id":125736465,"name":"hellocrud","full_name":"choonkeat/hellocrud","owner":{"login":"choonkeat","id":473,"avatar_url":"https://avatars3.githubusercontent.com/u/473?v=4","gravatar_id":"","url":"https://api.github.com/users/choonkeat","html_url":"https://github.com/choonkeat","followers_url":"https://api.github.com/users/choonkeat/followers","following_url":"https://api.github.com/users/choonkeat/following{/other_user}","gists_url":"https://api.github.com/users/choonkeat/gists{/gist_id}","starred_url":"https://api.github.com/users/choonkeat/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/choonkeat/subscriptions","organizations_url":"https://api.github.com/users/choonkeat/orgs","repos_url":"https://api.github.com/users/choonkeat/repos","events_url":"https://api.github.com/users/choonkeat/events{/privacy}","received_events_url":"https://api.github.com/users/choonkeat/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/choonkeat/hellocrud","description":null,"fork":false,"url":"https://api.github.com/repos/choonkeat/hellocrud","forks_url":"https://api.github.com/repos/choonkeat/hellocrud/forks","keys_url":"https://api.github.com/repos/choonkeat/hellocrud/keys{/key_id}","collaborators_url":"https://api.github.com/repos/choonkeat/hellocrud/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/choonkeat/hellocrud/teams","hooks_url":"https://api.github.com/repos/choonkeat/hellocrud/hooks","issue_events_url":"https://api.github.com/repos/choonkeat/hellocrud/issues/events{/number}","events_url":"https://api.github.com/repos/choonkeat/hellocrud/events","assignees_url":"https://api.github.com/repos/choonkeat/hellocrud/assignees{/user}","branches_url":"https://api.github.com/repos/choonkeat/hellocrud/branches{/branch}","tags_url":"https://api.github.com/repos/choonkeat/hellocrud/tags","blobs_url":"https://api.github.com/repos/choonkeat/hellocrud/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/choonkeat/hellocrud/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/choonkeat/hellocrud/git/refs{/sha}","trees_url":"https://api.github.com/repos/choonkeat/hellocrud/git/trees{/sha}","statuses_url":"https://api.github.com/repos/choonkeat/hellocrud/statuses/{sha}","languages_url":"https://api.github.com/repos/choonkeat/hellocrud/languages","stargazers_url":"https://api.github.com/repos/choonkeat/hellocrud/stargazers","contributors_url":"https://api.github.com/repos/choonkeat/hellocrud/contributors","subscribers_url":"https://api.github.com/repos/choonkeat/hellocrud/subscribers","subscription_url":"https://api.github.com/repos/choonkeat/hellocrud/subscription","commits_url":"https://api.github.com/repos/choonkeat/hellocrud/commits{/sha}","git_commits_url":"https://api.github.com/repos/choonkeat/hellocrud/git/commits{/sha}","comments_url":"https://api.github.com/repos/choonkeat/hellocrud/comments{/number}","issue_comment_url":"https://api.github.com/repos/choonkeat/hellocrud/issues/comments{/number}","contents_url":"https://api.github.com/repos/choonkeat/hellocrud/contents/{+path}","compare_url":"https://api.github.com/repos/choonkeat/hellocrud/compare/{base}...{head}","merges_url":"https://api.github.com/repos/choonkeat/hellocrud/merges","archive_url":"https://api.github.com/repos/choonkeat/hellocrud/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/choonkeat/hellocrud/downloads","issues_url":"https://api.github.com/repos/choonkeat/hellocrud/issues{/number}","pulls_url":"https://api.github.com/repos/choonkeat/hellocrud/pulls{/number}","milestones_url":"https://api.github.com/repos/choonkeat/hellocrud/milestones{/number}","notifications_url":"https://api.github.com/repos/choonkeat/hellocrud/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/choonkeat/hellocrud/labels{/name}","releases_url":"https://api.github.com/repos/choonkeat/hellocrud/releases{/id}","deployments_url":"https://api.github.com/repos/choonkeat/hellocrud/deployments","created_at":"2018-03-18T15:01:57Z","updated_at":"2018-04-13T06:13:29Z","pushed_at":"2018-04-13T15:47:18Z","git_url":"git://github.com/choonkeat/hellocrud.git","ssh_url":"git@github.com:choonkeat/hellocrud.git","clone_url":"https://github.com/choonkeat/hellocrud.git","svn_url":"https://github.com/choonkeat/hellocrud","homepage":null,"size":1922,"stargazers_count":1,"watchers_count":1,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":5,"license":null,"forks":0,"open_issues":5,"watchers":1,"default_branch":"master"}},"base":{"label":"choonkeat:master","ref":"master","sha":"db4e09e16eafd6dd9e1cbe51bb0bb986714bdd08","user":{"login":"choonkeat","id":473,"avatar_url":"https://avatars3.githubusercontent.com/u/473?v=4","gravatar_id":"","url":"https://api.github.com/users/choonkeat","html_url":"https://github.com/choonkeat","followers_url":"https://api.github.com/users/choonkeat/followers","following_url":"https://api.github.com/users/choonkeat/following{/other_user}","gists_url":"https://api.github.com/users/choonkeat/gists{/gist_id}","starred_url":"https://api.github.com/users/choonkeat/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/choonkeat/subscriptions","organizations_url":"https://api.github.com/users/choonkeat/orgs","repos_url":"https://api.github.com/users/choonkeat/repos","events_url":"https://api.github.com/users/choonkeat/events{/privacy}","received_events_url":"https://api.github.com/users/choonkeat/received_events","type":"User","site_admin":false},"repo":{"id":125736465,"name":"hellocrud","full_name":"choonkeat/hellocrud","owner":{"login":"choonkeat","id":473,"avatar_url":"https://avatars3.githubusercontent.com/u/473?v=4","gravatar_id":"","url":"https://api.github.com/users/choonkeat","html_url":"https://github.com/choonkeat","followers_url":"https://api.github.com/users/choonkeat/followers","following_url":"https://api.github.com/users/choonkeat/following{/other_user}","gists_url":"https://api.github.com/users/choonkeat/gists{/gist_id}","starred_url":"https://api.github.com/users/choonkeat/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/choonkeat/subscriptions","organizations_url":"https://api.github.com/users/choonkeat/orgs","repos_url":"https://api.github.com/users/choonkeat/repos","events_url":"https://api.github.com/users/choonkeat/events{/privacy}","received_events_url":"https://api.github.com/users/choonkeat/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/choonkeat/hellocrud","description":null,"fork":false,"url":"https://api.github.com/repos/choonkeat/hellocrud","forks_url":"https://api.github.com/repos/choonkeat/hellocrud/forks","keys_url":"https://api.github.com/repos/choonkeat/hellocrud/keys{/key_id}","collaborators_url":"https://api.github.com/repos/choonkeat/hellocrud/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/choonkeat/hellocrud/teams","hooks_url":"https://api.github.com/repos/choonkeat/hellocrud/hooks","issue_events_url":"https://api.github.com/repos/choonkeat/hellocrud/issues/events{/number}","events_url":"https://api.github.com/repos/choonkeat/hellocrud/events","assignees_url":"https://api.github.com/repos/choonkeat/hellocrud/assignees{/user}","branches_url":"https://api.github.com/repos/choonkeat/hellocrud/branches{/branch}","tags_url":"https://api.github.com/repos/choonkeat/hellocrud/tags","blobs_url":"https://api.github.com/repos/choonkeat/hellocrud/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/choonkeat/hellocrud/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/choonkeat/hellocrud/git/refs{/sha}","trees_url":"https://api.github.com/repos/choonkeat/hellocrud/git/trees{/sha}","statuses_url":"https://api.github.com/repos/choonkeat/hellocrud/statuses/{sha}","languages_url":"https://api.github.com/repos/choonkeat/hellocrud/languages","stargazers_url":"https://api.github.com/repos/choonkeat/hellocrud/stargazers","contributors_url":"https://api.github.com/repos/choonkeat/hellocrud/contributors","subscribers_url":"https://api.github.com/repos/choonkeat/hellocrud/subscribers","subscription_url":"https://api.github.com/repos/choonkeat/hellocrud/subscription","commits_url":"https://api.github.com/repos/choonkeat/hellocrud/commits{/sha}","git_commits_url":"https://api.github.com/repos/choonkeat/hellocrud/git/commits{/sha}","comments_url":"https://api.github.com/repos/choonkeat/hellocrud/comments{/number}","issue_comment_url":"https://api.github.com/repos/choonkeat/hellocrud/issues/comments{/number}","contents_url":"https://api.github.com/repos/choonkeat/hellocrud/contents/{+path}","compare_url":"https://api.github.com/repos/choonkeat/hellocrud/compare/{base}...{head}","merges_url":"https://api.github.com/repos/choonkeat/hellocrud/merges","archive_url":"https://api.github.com/repos/choonkeat/hellocrud/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/choonkeat/hellocrud/downloads","issues_url":"https://api.github.com/repos/choonkeat/hellocrud/issues{/number}","pulls_url":"https://api.github.com/repos/choonkeat/hellocrud/pulls{/number}","milestones_url":"https://api.github.com/repos/choonkeat/hellocrud/milestones{/number}","notifications_url":"https://api.github.com/repos/choonkeat/hellocrud/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/choonkeat/hellocrud/labels{/name}","releases_url":"https://api.github.com/repos/choonkeat/hellocrud/releases{/id}","deployments_url":"https://api.github.com/repos/choonkeat/hellocrud/deployments","created_at":"2018-03-18T15:01:57Z","updated_at":"2018-04-13T06:13:29Z","pushed_at":"2018-04-13T15:47:18Z","git_url":"git://github.com/choonkeat/hellocrud.git","ssh_url":"git@github.com:choonkeat/hellocrud.git","clone_url":"https://github.com/choonkeat/hellocrud.git","svn_url":"https://github.com/choonkeat/hellocrud","homepage":null,"size":1922,"stargazers_count":1,"watchers_count":1,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":5,"license":null,"forks":0,"open_issues":5,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/choonkeat/hellocrud/pulls/8"},"html":{"href":"https://github.com/choonkeat/hellocrud/pull/8"},"issue":{"href":"https://api.github.com/repos/choonkeat/hellocrud/issues/8"},"comments":{"href":"https://api.github.com/repos/choonkeat/hellocrud/issues/8/comments"},"review_comments":{"href":"https://api.github.com/repos/choonkeat/hellocrud/pulls/8/comments"},"review_comment":{"href":"https://api.github.com/repos/choonkeat/hellocrud/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/choonkeat/hellocrud/pulls/8/commits"},"statuses":{"href":"https://api.github.com/repos/choonkeat/hellocrud/statuses/6d27e9e6808dbc4cc64b584cfdc21a2b8381eb8f"}},"author_association":"COLLABORATOR"}}
{"actor":{"display_login":"severedsea"}}