id int32 0 167k | repo stringlengths 5 54 | path stringlengths 4 155 | func_name stringlengths 1 118 | original_string stringlengths 52 85.5k | language stringclasses 1
value | code stringlengths 52 85.5k | code_tokens list | docstring stringlengths 6 2.61k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 85 252 |
|---|---|---|---|---|---|---|---|---|---|---|---|
160,700 | google/go-github | github/github-accessors.go | GetRemoteName | func (s *SourceImportAuthor) GetRemoteName() string {
if s == nil || s.RemoteName == nil {
return ""
}
return *s.RemoteName
} | go | func (s *SourceImportAuthor) GetRemoteName() string {
if s == nil || s.RemoteName == nil {
return ""
}
return *s.RemoteName
} | [
"func",
"(",
"s",
"*",
"SourceImportAuthor",
")",
"GetRemoteName",
"(",
")",
"string",
"{",
"if",
"s",
"==",
"nil",
"||",
"s",
".",
"RemoteName",
"==",
"nil",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n",
"return",
"*",
"s",
".",
"RemoteName",
"\n",
... | // GetRemoteName returns the RemoteName field if it's non-nil, zero value otherwise. | [
"GetRemoteName",
"returns",
"the",
"RemoteName",
"field",
"if",
"it",
"s",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"."
] | 1fef44b9b427e6c43f92b2f20918e496c275393f | https://github.com/google/go-github/blob/1fef44b9b427e6c43f92b2f20918e496c275393f/github/github-accessors.go#L10680-L10685 |
160,701 | google/go-github | github/github-accessors.go | GetIgnored | func (s *Subscription) GetIgnored() bool {
if s == nil || s.Ignored == nil {
return false
}
return *s.Ignored
} | go | func (s *Subscription) GetIgnored() bool {
if s == nil || s.Ignored == nil {
return false
}
return *s.Ignored
} | [
"func",
"(",
"s",
"*",
"Subscription",
")",
"GetIgnored",
"(",
")",
"bool",
"{",
"if",
"s",
"==",
"nil",
"||",
"s",
".",
"Ignored",
"==",
"nil",
"{",
"return",
"false",
"\n",
"}",
"\n",
"return",
"*",
"s",
".",
"Ignored",
"\n",
"}"
] | // GetIgnored returns the Ignored field if it's non-nil, zero value otherwise. | [
"GetIgnored",
"returns",
"the",
"Ignored",
"field",
"if",
"it",
"s",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"."
] | 1fef44b9b427e6c43f92b2f20918e496c275393f | https://github.com/google/go-github/blob/1fef44b9b427e6c43f92b2f20918e496c275393f/github/github-accessors.go#L10856-L10861 |
160,702 | google/go-github | github/github-accessors.go | GetSubscribed | func (s *Subscription) GetSubscribed() bool {
if s == nil || s.Subscribed == nil {
return false
}
return *s.Subscribed
} | go | func (s *Subscription) GetSubscribed() bool {
if s == nil || s.Subscribed == nil {
return false
}
return *s.Subscribed
} | [
"func",
"(",
"s",
"*",
"Subscription",
")",
"GetSubscribed",
"(",
")",
"bool",
"{",
"if",
"s",
"==",
"nil",
"||",
"s",
".",
"Subscribed",
"==",
"nil",
"{",
"return",
"false",
"\n",
"}",
"\n",
"return",
"*",
"s",
".",
"Subscribed",
"\n",
"}"
] | // GetSubscribed returns the Subscribed field if it's non-nil, zero value otherwise. | [
"GetSubscribed",
"returns",
"the",
"Subscribed",
"field",
"if",
"it",
"s",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"."
] | 1fef44b9b427e6c43f92b2f20918e496c275393f | https://github.com/google/go-github/blob/1fef44b9b427e6c43f92b2f20918e496c275393f/github/github-accessors.go#L10880-L10885 |
160,703 | google/go-github | github/github-accessors.go | GetThreadURL | func (s *Subscription) GetThreadURL() string {
if s == nil || s.ThreadURL == nil {
return ""
}
return *s.ThreadURL
} | go | func (s *Subscription) GetThreadURL() string {
if s == nil || s.ThreadURL == nil {
return ""
}
return *s.ThreadURL
} | [
"func",
"(",
"s",
"*",
"Subscription",
")",
"GetThreadURL",
"(",
")",
"string",
"{",
"if",
"s",
"==",
"nil",
"||",
"s",
".",
"ThreadURL",
"==",
"nil",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n",
"return",
"*",
"s",
".",
"ThreadURL",
"\n",
"}"
] | // GetThreadURL returns the ThreadURL field if it's non-nil, zero value otherwise. | [
"GetThreadURL",
"returns",
"the",
"ThreadURL",
"field",
"if",
"it",
"s",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"."
] | 1fef44b9b427e6c43f92b2f20918e496c275393f | https://github.com/google/go-github/blob/1fef44b9b427e6c43f92b2f20918e496c275393f/github/github-accessors.go#L10888-L10893 |
160,704 | google/go-github | github/github-accessors.go | GetTag | func (t *Tag) GetTag() string {
if t == nil || t.Tag == nil {
return ""
}
return *t.Tag
} | go | func (t *Tag) GetTag() string {
if t == nil || t.Tag == nil {
return ""
}
return *t.Tag
} | [
"func",
"(",
"t",
"*",
"Tag",
")",
"GetTag",
"(",
")",
"string",
"{",
"if",
"t",
"==",
"nil",
"||",
"t",
".",
"Tag",
"==",
"nil",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n",
"return",
"*",
"t",
".",
"Tag",
"\n",
"}"
] | // GetTag returns the Tag field if it's non-nil, zero value otherwise. | [
"GetTag",
"returns",
"the",
"Tag",
"field",
"if",
"it",
"s",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"."
] | 1fef44b9b427e6c43f92b2f20918e496c275393f | https://github.com/google/go-github/blob/1fef44b9b427e6c43f92b2f20918e496c275393f/github/github-accessors.go#L10936-L10941 |
160,705 | google/go-github | github/github-accessors.go | GetMembersCount | func (t *Team) GetMembersCount() int {
if t == nil || t.MembersCount == nil {
return 0
}
return *t.MembersCount
} | go | func (t *Team) GetMembersCount() int {
if t == nil || t.MembersCount == nil {
return 0
}
return *t.MembersCount
} | [
"func",
"(",
"t",
"*",
"Team",
")",
"GetMembersCount",
"(",
")",
"int",
"{",
"if",
"t",
"==",
"nil",
"||",
"t",
".",
"MembersCount",
"==",
"nil",
"{",
"return",
"0",
"\n",
"}",
"\n",
"return",
"*",
"t",
".",
"MembersCount",
"\n",
"}"
] | // GetMembersCount returns the MembersCount field if it's non-nil, zero value otherwise. | [
"GetMembersCount",
"returns",
"the",
"MembersCount",
"field",
"if",
"it",
"s",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"."
] | 1fef44b9b427e6c43f92b2f20918e496c275393f | https://github.com/google/go-github/blob/1fef44b9b427e6c43f92b2f20918e496c275393f/github/github-accessors.go#L10992-L10997 |
160,706 | google/go-github | github/github-accessors.go | GetReposCount | func (t *Team) GetReposCount() int {
if t == nil || t.ReposCount == nil {
return 0
}
return *t.ReposCount
} | go | func (t *Team) GetReposCount() int {
if t == nil || t.ReposCount == nil {
return 0
}
return *t.ReposCount
} | [
"func",
"(",
"t",
"*",
"Team",
")",
"GetReposCount",
"(",
")",
"int",
"{",
"if",
"t",
"==",
"nil",
"||",
"t",
".",
"ReposCount",
"==",
"nil",
"{",
"return",
"0",
"\n",
"}",
"\n",
"return",
"*",
"t",
".",
"ReposCount",
"\n",
"}"
] | // GetReposCount returns the ReposCount field if it's non-nil, zero value otherwise. | [
"GetReposCount",
"returns",
"the",
"ReposCount",
"field",
"if",
"it",
"s",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"."
] | 1fef44b9b427e6c43f92b2f20918e496c275393f | https://github.com/google/go-github/blob/1fef44b9b427e6c43f92b2f20918e496c275393f/github/github-accessors.go#L11056-L11061 |
160,707 | google/go-github | github/github-accessors.go | GetCommentsCount | func (t *TeamDiscussion) GetCommentsCount() int {
if t == nil || t.CommentsCount == nil {
return 0
}
return *t.CommentsCount
} | go | func (t *TeamDiscussion) GetCommentsCount() int {
if t == nil || t.CommentsCount == nil {
return 0
}
return *t.CommentsCount
} | [
"func",
"(",
"t",
"*",
"TeamDiscussion",
")",
"GetCommentsCount",
"(",
")",
"int",
"{",
"if",
"t",
"==",
"nil",
"||",
"t",
".",
"CommentsCount",
"==",
"nil",
"{",
"return",
"0",
"\n",
"}",
"\n",
"return",
"*",
"t",
".",
"CommentsCount",
"\n",
"}"
] | // GetCommentsCount returns the CommentsCount field if it's non-nil, zero value otherwise. | [
"GetCommentsCount",
"returns",
"the",
"CommentsCount",
"field",
"if",
"it",
"s",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"."
] | 1fef44b9b427e6c43f92b2f20918e496c275393f | https://github.com/google/go-github/blob/1fef44b9b427e6c43f92b2f20918e496c275393f/github/github-accessors.go#L11160-L11165 |
160,708 | google/go-github | github/github-accessors.go | GetPinned | func (t *TeamDiscussion) GetPinned() bool {
if t == nil || t.Pinned == nil {
return false
}
return *t.Pinned
} | go | func (t *TeamDiscussion) GetPinned() bool {
if t == nil || t.Pinned == nil {
return false
}
return *t.Pinned
} | [
"func",
"(",
"t",
"*",
"TeamDiscussion",
")",
"GetPinned",
"(",
")",
"bool",
"{",
"if",
"t",
"==",
"nil",
"||",
"t",
".",
"Pinned",
"==",
"nil",
"{",
"return",
"false",
"\n",
"}",
"\n",
"return",
"*",
"t",
".",
"Pinned",
"\n",
"}"
] | // GetPinned returns the Pinned field if it's non-nil, zero value otherwise. | [
"GetPinned",
"returns",
"the",
"Pinned",
"field",
"if",
"it",
"s",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"."
] | 1fef44b9b427e6c43f92b2f20918e496c275393f | https://github.com/google/go-github/blob/1fef44b9b427e6c43f92b2f20918e496c275393f/github/github-accessors.go#L11216-L11221 |
160,709 | google/go-github | github/github-accessors.go | GetTeamURL | func (t *TeamDiscussion) GetTeamURL() string {
if t == nil || t.TeamURL == nil {
return ""
}
return *t.TeamURL
} | go | func (t *TeamDiscussion) GetTeamURL() string {
if t == nil || t.TeamURL == nil {
return ""
}
return *t.TeamURL
} | [
"func",
"(",
"t",
"*",
"TeamDiscussion",
")",
"GetTeamURL",
"(",
")",
"string",
"{",
"if",
"t",
"==",
"nil",
"||",
"t",
".",
"TeamURL",
"==",
"nil",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n",
"return",
"*",
"t",
".",
"TeamURL",
"\n",
"}"
] | // GetTeamURL returns the TeamURL field if it's non-nil, zero value otherwise. | [
"GetTeamURL",
"returns",
"the",
"TeamURL",
"field",
"if",
"it",
"s",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"."
] | 1fef44b9b427e6c43f92b2f20918e496c275393f | https://github.com/google/go-github/blob/1fef44b9b427e6c43f92b2f20918e496c275393f/github/github-accessors.go#L11240-L11245 |
160,710 | google/go-github | github/github-accessors.go | GetFragment | func (t *TextMatch) GetFragment() string {
if t == nil || t.Fragment == nil {
return ""
}
return *t.Fragment
} | go | func (t *TextMatch) GetFragment() string {
if t == nil || t.Fragment == nil {
return ""
}
return *t.Fragment
} | [
"func",
"(",
"t",
"*",
"TextMatch",
")",
"GetFragment",
"(",
")",
"string",
"{",
"if",
"t",
"==",
"nil",
"||",
"t",
".",
"Fragment",
"==",
"nil",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n",
"return",
"*",
"t",
".",
"Fragment",
"\n",
"}"
] | // GetFragment returns the Fragment field if it's non-nil, zero value otherwise. | [
"GetFragment",
"returns",
"the",
"Fragment",
"field",
"if",
"it",
"s",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"."
] | 1fef44b9b427e6c43f92b2f20918e496c275393f | https://github.com/google/go-github/blob/1fef44b9b427e6c43f92b2f20918e496c275393f/github/github-accessors.go#L11416-L11421 |
160,711 | google/go-github | github/github-accessors.go | GetObjectType | func (t *TextMatch) GetObjectType() string {
if t == nil || t.ObjectType == nil {
return ""
}
return *t.ObjectType
} | go | func (t *TextMatch) GetObjectType() string {
if t == nil || t.ObjectType == nil {
return ""
}
return *t.ObjectType
} | [
"func",
"(",
"t",
"*",
"TextMatch",
")",
"GetObjectType",
"(",
")",
"string",
"{",
"if",
"t",
"==",
"nil",
"||",
"t",
".",
"ObjectType",
"==",
"nil",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n",
"return",
"*",
"t",
".",
"ObjectType",
"\n",
"}"
] | // GetObjectType returns the ObjectType field if it's non-nil, zero value otherwise. | [
"GetObjectType",
"returns",
"the",
"ObjectType",
"field",
"if",
"it",
"s",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"."
] | 1fef44b9b427e6c43f92b2f20918e496c275393f | https://github.com/google/go-github/blob/1fef44b9b427e6c43f92b2f20918e496c275393f/github/github-accessors.go#L11424-L11429 |
160,712 | google/go-github | github/github-accessors.go | GetObjectURL | func (t *TextMatch) GetObjectURL() string {
if t == nil || t.ObjectURL == nil {
return ""
}
return *t.ObjectURL
} | go | func (t *TextMatch) GetObjectURL() string {
if t == nil || t.ObjectURL == nil {
return ""
}
return *t.ObjectURL
} | [
"func",
"(",
"t",
"*",
"TextMatch",
")",
"GetObjectURL",
"(",
")",
"string",
"{",
"if",
"t",
"==",
"nil",
"||",
"t",
".",
"ObjectURL",
"==",
"nil",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n",
"return",
"*",
"t",
".",
"ObjectURL",
"\n",
"}"
] | // GetObjectURL returns the ObjectURL field if it's non-nil, zero value otherwise. | [
"GetObjectURL",
"returns",
"the",
"ObjectURL",
"field",
"if",
"it",
"s",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"."
] | 1fef44b9b427e6c43f92b2f20918e496c275393f | https://github.com/google/go-github/blob/1fef44b9b427e6c43f92b2f20918e496c275393f/github/github-accessors.go#L11432-L11437 |
160,713 | google/go-github | github/github-accessors.go | GetProperty | func (t *TextMatch) GetProperty() string {
if t == nil || t.Property == nil {
return ""
}
return *t.Property
} | go | func (t *TextMatch) GetProperty() string {
if t == nil || t.Property == nil {
return ""
}
return *t.Property
} | [
"func",
"(",
"t",
"*",
"TextMatch",
")",
"GetProperty",
"(",
")",
"string",
"{",
"if",
"t",
"==",
"nil",
"||",
"t",
".",
"Property",
"==",
"nil",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n",
"return",
"*",
"t",
".",
"Property",
"\n",
"}"
] | // GetProperty returns the Property field if it's non-nil, zero value otherwise. | [
"GetProperty",
"returns",
"the",
"Property",
"field",
"if",
"it",
"s",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"."
] | 1fef44b9b427e6c43f92b2f20918e496c275393f | https://github.com/google/go-github/blob/1fef44b9b427e6c43f92b2f20918e496c275393f/github/github-accessors.go#L11440-L11445 |
160,714 | google/go-github | github/github-accessors.go | GetReferrer | func (t *TrafficReferrer) GetReferrer() string {
if t == nil || t.Referrer == nil {
return ""
}
return *t.Referrer
} | go | func (t *TrafficReferrer) GetReferrer() string {
if t == nil || t.Referrer == nil {
return ""
}
return *t.Referrer
} | [
"func",
"(",
"t",
"*",
"TrafficReferrer",
")",
"GetReferrer",
"(",
")",
"string",
"{",
"if",
"t",
"==",
"nil",
"||",
"t",
".",
"Referrer",
"==",
"nil",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n",
"return",
"*",
"t",
".",
"Referrer",
"\n",
"}"
] | // GetReferrer returns the Referrer field if it's non-nil, zero value otherwise. | [
"GetReferrer",
"returns",
"the",
"Referrer",
"field",
"if",
"it",
"s",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"."
] | 1fef44b9b427e6c43f92b2f20918e496c275393f | https://github.com/google/go-github/blob/1fef44b9b427e6c43f92b2f20918e496c275393f/github/github-accessors.go#L11632-L11637 |
160,715 | google/go-github | github/github-accessors.go | GetTruncated | func (t *Tree) GetTruncated() bool {
if t == nil || t.Truncated == nil {
return false
}
return *t.Truncated
} | go | func (t *Tree) GetTruncated() bool {
if t == nil || t.Truncated == nil {
return false
}
return *t.Truncated
} | [
"func",
"(",
"t",
"*",
"Tree",
")",
"GetTruncated",
"(",
")",
"bool",
"{",
"if",
"t",
"==",
"nil",
"||",
"t",
".",
"Truncated",
"==",
"nil",
"{",
"return",
"false",
"\n",
"}",
"\n",
"return",
"*",
"t",
".",
"Truncated",
"\n",
"}"
] | // GetTruncated returns the Truncated field if it's non-nil, zero value otherwise. | [
"GetTruncated",
"returns",
"the",
"Truncated",
"field",
"if",
"it",
"s",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"."
] | 1fef44b9b427e6c43f92b2f20918e496c275393f | https://github.com/google/go-github/blob/1fef44b9b427e6c43f92b2f20918e496c275393f/github/github-accessors.go#L11672-L11677 |
160,716 | google/go-github | github/github-accessors.go | GetMode | func (t *TreeEntry) GetMode() string {
if t == nil || t.Mode == nil {
return ""
}
return *t.Mode
} | go | func (t *TreeEntry) GetMode() string {
if t == nil || t.Mode == nil {
return ""
}
return *t.Mode
} | [
"func",
"(",
"t",
"*",
"TreeEntry",
")",
"GetMode",
"(",
")",
"string",
"{",
"if",
"t",
"==",
"nil",
"||",
"t",
".",
"Mode",
"==",
"nil",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n",
"return",
"*",
"t",
".",
"Mode",
"\n",
"}"
] | // GetMode returns the Mode field if it's non-nil, zero value otherwise. | [
"GetMode",
"returns",
"the",
"Mode",
"field",
"if",
"it",
"s",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"."
] | 1fef44b9b427e6c43f92b2f20918e496c275393f | https://github.com/google/go-github/blob/1fef44b9b427e6c43f92b2f20918e496c275393f/github/github-accessors.go#L11688-L11693 |
160,717 | google/go-github | github/github-accessors.go | GetBio | func (u *User) GetBio() string {
if u == nil || u.Bio == nil {
return ""
}
return *u.Bio
} | go | func (u *User) GetBio() string {
if u == nil || u.Bio == nil {
return ""
}
return *u.Bio
} | [
"func",
"(",
"u",
"*",
"User",
")",
"GetBio",
"(",
")",
"string",
"{",
"if",
"u",
"==",
"nil",
"||",
"u",
".",
"Bio",
"==",
"nil",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n",
"return",
"*",
"u",
".",
"Bio",
"\n",
"}"
] | // GetBio returns the Bio field if it's non-nil, zero value otherwise. | [
"GetBio",
"returns",
"the",
"Bio",
"field",
"if",
"it",
"s",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"."
] | 1fef44b9b427e6c43f92b2f20918e496c275393f | https://github.com/google/go-github/blob/1fef44b9b427e6c43f92b2f20918e496c275393f/github/github-accessors.go#L11808-L11813 |
160,718 | google/go-github | github/github-accessors.go | GetHireable | func (u *User) GetHireable() bool {
if u == nil || u.Hireable == nil {
return false
}
return *u.Hireable
} | go | func (u *User) GetHireable() bool {
if u == nil || u.Hireable == nil {
return false
}
return *u.Hireable
} | [
"func",
"(",
"u",
"*",
"User",
")",
"GetHireable",
"(",
")",
"bool",
"{",
"if",
"u",
"==",
"nil",
"||",
"u",
".",
"Hireable",
"==",
"nil",
"{",
"return",
"false",
"\n",
"}",
"\n",
"return",
"*",
"u",
".",
"Hireable",
"\n",
"}"
] | // GetHireable returns the Hireable field if it's non-nil, zero value otherwise. | [
"GetHireable",
"returns",
"the",
"Hireable",
"field",
"if",
"it",
"s",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"."
] | 1fef44b9b427e6c43f92b2f20918e496c275393f | https://github.com/google/go-github/blob/1fef44b9b427e6c43f92b2f20918e496c275393f/github/github-accessors.go#L11920-L11925 |
160,719 | google/go-github | github/github-accessors.go | GetSuspendedAt | func (u *User) GetSuspendedAt() Timestamp {
if u == nil || u.SuspendedAt == nil {
return Timestamp{}
}
return *u.SuspendedAt
} | go | func (u *User) GetSuspendedAt() Timestamp {
if u == nil || u.SuspendedAt == nil {
return Timestamp{}
}
return *u.SuspendedAt
} | [
"func",
"(",
"u",
"*",
"User",
")",
"GetSuspendedAt",
"(",
")",
"Timestamp",
"{",
"if",
"u",
"==",
"nil",
"||",
"u",
".",
"SuspendedAt",
"==",
"nil",
"{",
"return",
"Timestamp",
"{",
"}",
"\n",
"}",
"\n",
"return",
"*",
"u",
".",
"SuspendedAt",
"\n... | // GetSuspendedAt returns the SuspendedAt field if it's non-nil, zero value otherwise. | [
"GetSuspendedAt",
"returns",
"the",
"SuspendedAt",
"field",
"if",
"it",
"s",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"."
] | 1fef44b9b427e6c43f92b2f20918e496c275393f | https://github.com/google/go-github/blob/1fef44b9b427e6c43f92b2f20918e496c275393f/github/github-accessors.go#L12072-L12077 |
160,720 | google/go-github | github/github-accessors.go | GetTwoFactorAuthentication | func (u *User) GetTwoFactorAuthentication() bool {
if u == nil || u.TwoFactorAuthentication == nil {
return false
}
return *u.TwoFactorAuthentication
} | go | func (u *User) GetTwoFactorAuthentication() bool {
if u == nil || u.TwoFactorAuthentication == nil {
return false
}
return *u.TwoFactorAuthentication
} | [
"func",
"(",
"u",
"*",
"User",
")",
"GetTwoFactorAuthentication",
"(",
")",
"bool",
"{",
"if",
"u",
"==",
"nil",
"||",
"u",
".",
"TwoFactorAuthentication",
"==",
"nil",
"{",
"return",
"false",
"\n",
"}",
"\n",
"return",
"*",
"u",
".",
"TwoFactorAuthentic... | // GetTwoFactorAuthentication returns the TwoFactorAuthentication field if it's non-nil, zero value otherwise. | [
"GetTwoFactorAuthentication",
"returns",
"the",
"TwoFactorAuthentication",
"field",
"if",
"it",
"s",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"."
] | 1fef44b9b427e6c43f92b2f20918e496c275393f | https://github.com/google/go-github/blob/1fef44b9b427e6c43f92b2f20918e496c275393f/github/github-accessors.go#L12088-L12093 |
160,721 | google/go-github | github/github-accessors.go | GetOcticon | func (u *UserContext) GetOcticon() string {
if u == nil || u.Octicon == nil {
return ""
}
return *u.Octicon
} | go | func (u *UserContext) GetOcticon() string {
if u == nil || u.Octicon == nil {
return ""
}
return *u.Octicon
} | [
"func",
"(",
"u",
"*",
"UserContext",
")",
"GetOcticon",
"(",
")",
"string",
"{",
"if",
"u",
"==",
"nil",
"||",
"u",
".",
"Octicon",
"==",
"nil",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n",
"return",
"*",
"u",
".",
"Octicon",
"\n",
"}"
] | // GetOcticon returns the Octicon field if it's non-nil, zero value otherwise. | [
"GetOcticon",
"returns",
"the",
"Octicon",
"field",
"if",
"it",
"s",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"."
] | 1fef44b9b427e6c43f92b2f20918e496c275393f | https://github.com/google/go-github/blob/1fef44b9b427e6c43f92b2f20918e496c275393f/github/github-accessors.go#L12128-L12133 |
160,722 | google/go-github | github/github-accessors.go | GetPrimary | func (u *UserEmail) GetPrimary() bool {
if u == nil || u.Primary == nil {
return false
}
return *u.Primary
} | go | func (u *UserEmail) GetPrimary() bool {
if u == nil || u.Primary == nil {
return false
}
return *u.Primary
} | [
"func",
"(",
"u",
"*",
"UserEmail",
")",
"GetPrimary",
"(",
")",
"bool",
"{",
"if",
"u",
"==",
"nil",
"||",
"u",
".",
"Primary",
"==",
"nil",
"{",
"return",
"false",
"\n",
"}",
"\n",
"return",
"*",
"u",
".",
"Primary",
"\n",
"}"
] | // GetPrimary returns the Primary field if it's non-nil, zero value otherwise. | [
"GetPrimary",
"returns",
"the",
"Primary",
"field",
"if",
"it",
"s",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"."
] | 1fef44b9b427e6c43f92b2f20918e496c275393f | https://github.com/google/go-github/blob/1fef44b9b427e6c43f92b2f20918e496c275393f/github/github-accessors.go#L12144-L12149 |
160,723 | google/go-github | github/github-accessors.go | GetAdminUsers | func (u *UserStats) GetAdminUsers() int {
if u == nil || u.AdminUsers == nil {
return 0
}
return *u.AdminUsers
} | go | func (u *UserStats) GetAdminUsers() int {
if u == nil || u.AdminUsers == nil {
return 0
}
return *u.AdminUsers
} | [
"func",
"(",
"u",
"*",
"UserStats",
")",
"GetAdminUsers",
"(",
")",
"int",
"{",
"if",
"u",
"==",
"nil",
"||",
"u",
".",
"AdminUsers",
"==",
"nil",
"{",
"return",
"0",
"\n",
"}",
"\n",
"return",
"*",
"u",
".",
"AdminUsers",
"\n",
"}"
] | // GetAdminUsers returns the AdminUsers field if it's non-nil, zero value otherwise. | [
"GetAdminUsers",
"returns",
"the",
"AdminUsers",
"field",
"if",
"it",
"s",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"."
] | 1fef44b9b427e6c43f92b2f20918e496c275393f | https://github.com/google/go-github/blob/1fef44b9b427e6c43f92b2f20918e496c275393f/github/github-accessors.go#L12376-L12381 |
160,724 | google/go-github | github/github-accessors.go | GetSuspendedUsers | func (u *UserStats) GetSuspendedUsers() int {
if u == nil || u.SuspendedUsers == nil {
return 0
}
return *u.SuspendedUsers
} | go | func (u *UserStats) GetSuspendedUsers() int {
if u == nil || u.SuspendedUsers == nil {
return 0
}
return *u.SuspendedUsers
} | [
"func",
"(",
"u",
"*",
"UserStats",
")",
"GetSuspendedUsers",
"(",
")",
"int",
"{",
"if",
"u",
"==",
"nil",
"||",
"u",
".",
"SuspendedUsers",
"==",
"nil",
"{",
"return",
"0",
"\n",
"}",
"\n",
"return",
"*",
"u",
".",
"SuspendedUsers",
"\n",
"}"
] | // GetSuspendedUsers returns the SuspendedUsers field if it's non-nil, zero value otherwise. | [
"GetSuspendedUsers",
"returns",
"the",
"SuspendedUsers",
"field",
"if",
"it",
"s",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"."
] | 1fef44b9b427e6c43f92b2f20918e496c275393f | https://github.com/google/go-github/blob/1fef44b9b427e6c43f92b2f20918e496c275393f/github/github-accessors.go#L12384-L12389 |
160,725 | google/go-github | github/github-accessors.go | GetTotalUsers | func (u *UserStats) GetTotalUsers() int {
if u == nil || u.TotalUsers == nil {
return 0
}
return *u.TotalUsers
} | go | func (u *UserStats) GetTotalUsers() int {
if u == nil || u.TotalUsers == nil {
return 0
}
return *u.TotalUsers
} | [
"func",
"(",
"u",
"*",
"UserStats",
")",
"GetTotalUsers",
"(",
")",
"int",
"{",
"if",
"u",
"==",
"nil",
"||",
"u",
".",
"TotalUsers",
"==",
"nil",
"{",
"return",
"0",
"\n",
"}",
"\n",
"return",
"*",
"u",
".",
"TotalUsers",
"\n",
"}"
] | // GetTotalUsers returns the TotalUsers field if it's non-nil, zero value otherwise. | [
"GetTotalUsers",
"returns",
"the",
"TotalUsers",
"field",
"if",
"it",
"s",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"."
] | 1fef44b9b427e6c43f92b2f20918e496c275393f | https://github.com/google/go-github/blob/1fef44b9b427e6c43f92b2f20918e496c275393f/github/github-accessors.go#L12392-L12397 |
160,726 | google/go-github | github/github-accessors.go | GetUsername | func (w *WebHookAuthor) GetUsername() string {
if w == nil || w.Username == nil {
return ""
}
return *w.Username
} | go | func (w *WebHookAuthor) GetUsername() string {
if w == nil || w.Username == nil {
return ""
}
return *w.Username
} | [
"func",
"(",
"w",
"*",
"WebHookAuthor",
")",
"GetUsername",
"(",
")",
"string",
"{",
"if",
"w",
"==",
"nil",
"||",
"w",
".",
"Username",
"==",
"nil",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n",
"return",
"*",
"w",
".",
"Username",
"\n",
"}"
] | // GetUsername returns the Username field if it's non-nil, zero value otherwise. | [
"GetUsername",
"returns",
"the",
"Username",
"field",
"if",
"it",
"s",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"."
] | 1fef44b9b427e6c43f92b2f20918e496c275393f | https://github.com/google/go-github/blob/1fef44b9b427e6c43f92b2f20918e496c275393f/github/github-accessors.go#L12456-L12461 |
160,727 | graphql-go/graphql | schema.go | AddImplementation | func (gq *Schema) AddImplementation() error {
// Keep track of all implementations by interface name.
if gq.implementations == nil {
gq.implementations = map[string][]*Object{}
}
for _, ttype := range gq.typeMap {
if ttype, ok := ttype.(*Object); ok {
for _, iface := range ttype.Interfaces() {
impls, ok... | go | func (gq *Schema) AddImplementation() error {
// Keep track of all implementations by interface name.
if gq.implementations == nil {
gq.implementations = map[string][]*Object{}
}
for _, ttype := range gq.typeMap {
if ttype, ok := ttype.(*Object); ok {
for _, iface := range ttype.Interfaces() {
impls, ok... | [
"func",
"(",
"gq",
"*",
"Schema",
")",
"AddImplementation",
"(",
")",
"error",
"{",
"// Keep track of all implementations by interface name.",
"if",
"gq",
".",
"implementations",
"==",
"nil",
"{",
"gq",
".",
"implementations",
"=",
"map",
"[",
"string",
"]",
"["... | //Added Check implementation of interfaces at runtime..
//Add Implementations at Runtime.. | [
"Added",
"Check",
"implementation",
"of",
"interfaces",
"at",
"runtime",
"..",
"Add",
"Implementations",
"at",
"Runtime",
".."
] | 199d20bbfed70dae8c7d4619d4e0d339ce738b43 | https://github.com/graphql-go/graphql/blob/199d20bbfed70dae8c7d4619d4e0d339ce738b43/schema.go#L154-L186 |
160,728 | graphql-go/graphql | schema.go | AppendType | func (gq *Schema) AppendType(objectType Type) error {
if objectType.Error() != nil {
return objectType.Error()
}
var err error
gq.typeMap, err = typeMapReducer(gq, gq.typeMap, objectType)
if err != nil {
return err
}
//Now Add interface implementation..
return gq.AddImplementation()
} | go | func (gq *Schema) AppendType(objectType Type) error {
if objectType.Error() != nil {
return objectType.Error()
}
var err error
gq.typeMap, err = typeMapReducer(gq, gq.typeMap, objectType)
if err != nil {
return err
}
//Now Add interface implementation..
return gq.AddImplementation()
} | [
"func",
"(",
"gq",
"*",
"Schema",
")",
"AppendType",
"(",
"objectType",
"Type",
")",
"error",
"{",
"if",
"objectType",
".",
"Error",
"(",
")",
"!=",
"nil",
"{",
"return",
"objectType",
".",
"Error",
"(",
")",
"\n",
"}",
"\n",
"var",
"err",
"error",
... | //Edited. To check add Types at RunTime..
//Append Runtime schema to typeMap | [
"Edited",
".",
"To",
"check",
"add",
"Types",
"at",
"RunTime",
"..",
"Append",
"Runtime",
"schema",
"to",
"typeMap"
] | 199d20bbfed70dae8c7d4619d4e0d339ce738b43 | https://github.com/graphql-go/graphql/blob/199d20bbfed70dae8c7d4619d4e0d339ce738b43/schema.go#L190-L201 |
160,729 | graphql-go/graphql | schema.go | AddExtensions | func (gq *Schema) AddExtensions(e ...Extension) {
gq.extensions = append(gq.extensions, e...)
} | go | func (gq *Schema) AddExtensions(e ...Extension) {
gq.extensions = append(gq.extensions, e...)
} | [
"func",
"(",
"gq",
"*",
"Schema",
")",
"AddExtensions",
"(",
"e",
"...",
"Extension",
")",
"{",
"gq",
".",
"extensions",
"=",
"append",
"(",
"gq",
".",
"extensions",
",",
"e",
"...",
")",
"\n",
"}"
] | // AddExtensions can be used to add additional extensions to the schema | [
"AddExtensions",
"can",
"be",
"used",
"to",
"add",
"additional",
"extensions",
"to",
"the",
"schema"
] | 199d20bbfed70dae8c7d4619d4e0d339ce738b43 | https://github.com/graphql-go/graphql/blob/199d20bbfed70dae8c7d4619d4e0d339ce738b43/schema.go#L270-L272 |
160,730 | graphql-go/graphql | definition.go | IsInputType | func IsInputType(ttype Type) bool {
switch GetNamed(ttype).(type) {
case *Scalar, *Enum, *InputObject:
return true
default:
return false
}
} | go | func IsInputType(ttype Type) bool {
switch GetNamed(ttype).(type) {
case *Scalar, *Enum, *InputObject:
return true
default:
return false
}
} | [
"func",
"IsInputType",
"(",
"ttype",
"Type",
")",
"bool",
"{",
"switch",
"GetNamed",
"(",
"ttype",
")",
".",
"(",
"type",
")",
"{",
"case",
"*",
"Scalar",
",",
"*",
"Enum",
",",
"*",
"InputObject",
":",
"return",
"true",
"\n",
"default",
":",
"return... | // IsInputType determines if given type is a GraphQLInputType | [
"IsInputType",
"determines",
"if",
"given",
"type",
"is",
"a",
"GraphQLInputType"
] | 199d20bbfed70dae8c7d4619d4e0d339ce738b43 | https://github.com/graphql-go/graphql/blob/199d20bbfed70dae8c7d4619d4e0d339ce738b43/definition.go#L45-L52 |
160,731 | graphql-go/graphql | definition.go | IsOutputType | func IsOutputType(ttype Type) bool {
switch GetNamed(ttype).(type) {
case *Scalar, *Object, *Interface, *Union, *Enum:
return true
default:
return false
}
} | go | func IsOutputType(ttype Type) bool {
switch GetNamed(ttype).(type) {
case *Scalar, *Object, *Interface, *Union, *Enum:
return true
default:
return false
}
} | [
"func",
"IsOutputType",
"(",
"ttype",
"Type",
")",
"bool",
"{",
"switch",
"GetNamed",
"(",
"ttype",
")",
".",
"(",
"type",
")",
"{",
"case",
"*",
"Scalar",
",",
"*",
"Object",
",",
"*",
"Interface",
",",
"*",
"Union",
",",
"*",
"Enum",
":",
"return... | // IsOutputType determines if given type is a GraphQLOutputType | [
"IsOutputType",
"determines",
"if",
"given",
"type",
"is",
"a",
"GraphQLOutputType"
] | 199d20bbfed70dae8c7d4619d4e0d339ce738b43 | https://github.com/graphql-go/graphql/blob/199d20bbfed70dae8c7d4619d4e0d339ce738b43/definition.go#L55-L62 |
160,732 | graphql-go/graphql | definition.go | IsLeafType | func IsLeafType(ttype Type) bool {
switch GetNamed(ttype).(type) {
case *Scalar, *Enum:
return true
default:
return false
}
} | go | func IsLeafType(ttype Type) bool {
switch GetNamed(ttype).(type) {
case *Scalar, *Enum:
return true
default:
return false
}
} | [
"func",
"IsLeafType",
"(",
"ttype",
"Type",
")",
"bool",
"{",
"switch",
"GetNamed",
"(",
"ttype",
")",
".",
"(",
"type",
")",
"{",
"case",
"*",
"Scalar",
",",
"*",
"Enum",
":",
"return",
"true",
"\n",
"default",
":",
"return",
"false",
"\n",
"}",
"... | // IsLeafType determines if given type is a leaf value | [
"IsLeafType",
"determines",
"if",
"given",
"type",
"is",
"a",
"leaf",
"value"
] | 199d20bbfed70dae8c7d4619d4e0d339ce738b43 | https://github.com/graphql-go/graphql/blob/199d20bbfed70dae8c7d4619d4e0d339ce738b43/definition.go#L77-L84 |
160,733 | graphql-go/graphql | definition.go | GetNullable | func GetNullable(ttype Type) Nullable {
if ttype, ok := ttype.(*NonNull); ok {
return ttype.OfType
}
return ttype
} | go | func GetNullable(ttype Type) Nullable {
if ttype, ok := ttype.(*NonNull); ok {
return ttype.OfType
}
return ttype
} | [
"func",
"GetNullable",
"(",
"ttype",
"Type",
")",
"Nullable",
"{",
"if",
"ttype",
",",
"ok",
":=",
"ttype",
".",
"(",
"*",
"NonNull",
")",
";",
"ok",
"{",
"return",
"ttype",
".",
"OfType",
"\n",
"}",
"\n",
"return",
"ttype",
"\n",
"}"
] | // GetNullable returns the Nullable type of the given GraphQL type | [
"GetNullable",
"returns",
"the",
"Nullable",
"type",
"of",
"the",
"given",
"GraphQL",
"type"
] | 199d20bbfed70dae8c7d4619d4e0d339ce738b43 | https://github.com/graphql-go/graphql/blob/199d20bbfed70dae8c7d4619d4e0d339ce738b43/definition.go#L154-L159 |
160,734 | graphql-go/graphql | definition.go | GetNamed | func GetNamed(ttype Type) Named {
unmodifiedType := ttype
for {
switch typ := unmodifiedType.(type) {
case *List:
unmodifiedType = typ.OfType
case *NonNull:
unmodifiedType = typ.OfType
default:
return unmodifiedType
}
}
} | go | func GetNamed(ttype Type) Named {
unmodifiedType := ttype
for {
switch typ := unmodifiedType.(type) {
case *List:
unmodifiedType = typ.OfType
case *NonNull:
unmodifiedType = typ.OfType
default:
return unmodifiedType
}
}
} | [
"func",
"GetNamed",
"(",
"ttype",
"Type",
")",
"Named",
"{",
"unmodifiedType",
":=",
"ttype",
"\n",
"for",
"{",
"switch",
"typ",
":=",
"unmodifiedType",
".",
"(",
"type",
")",
"{",
"case",
"*",
"List",
":",
"unmodifiedType",
"=",
"typ",
".",
"OfType",
... | // GetNamed returns the Named type of the given GraphQL type | [
"GetNamed",
"returns",
"the",
"Named",
"type",
"of",
"the",
"given",
"GraphQL",
"type"
] | 199d20bbfed70dae8c7d4619d4e0d339ce738b43 | https://github.com/graphql-go/graphql/blob/199d20bbfed70dae8c7d4619d4e0d339ce738b43/definition.go#L174-L186 |
160,735 | graphql-go/graphql | definition.go | NewScalar | func NewScalar(config ScalarConfig) *Scalar {
st := &Scalar{}
err := invariant(config.Name != "", "Type must be named.")
if err != nil {
st.err = err
return st
}
err = assertValidName(config.Name)
if err != nil {
st.err = err
return st
}
st.PrivateName = config.Name
st.PrivateDescription = config.Des... | go | func NewScalar(config ScalarConfig) *Scalar {
st := &Scalar{}
err := invariant(config.Name != "", "Type must be named.")
if err != nil {
st.err = err
return st
}
err = assertValidName(config.Name)
if err != nil {
st.err = err
return st
}
st.PrivateName = config.Name
st.PrivateDescription = config.Des... | [
"func",
"NewScalar",
"(",
"config",
"ScalarConfig",
")",
"*",
"Scalar",
"{",
"st",
":=",
"&",
"Scalar",
"{",
"}",
"\n",
"err",
":=",
"invariant",
"(",
"config",
".",
"Name",
"!=",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"if",
"err",
"!=",
"nil",
... | // NewScalar creates a new GraphQLScalar | [
"NewScalar",
"creates",
"a",
"new",
"GraphQLScalar"
] | 199d20bbfed70dae8c7d4619d4e0d339ce738b43 | https://github.com/graphql-go/graphql/blob/199d20bbfed70dae8c7d4619d4e0d339ce738b43/definition.go#L230-L270 |
160,736 | graphql-go/graphql | definition.go | WithKey | func (p *ResponsePath) WithKey(key interface{}) *ResponsePath {
return &ResponsePath{
Prev: p,
Key: key,
}
} | go | func (p *ResponsePath) WithKey(key interface{}) *ResponsePath {
return &ResponsePath{
Prev: p,
Key: key,
}
} | [
"func",
"(",
"p",
"*",
"ResponsePath",
")",
"WithKey",
"(",
"key",
"interface",
"{",
"}",
")",
"*",
"ResponsePath",
"{",
"return",
"&",
"ResponsePath",
"{",
"Prev",
":",
"p",
",",
"Key",
":",
"key",
",",
"}",
"\n",
"}"
] | // WithKey returns a new responsePath containing the new key. | [
"WithKey",
"returns",
"a",
"new",
"responsePath",
"containing",
"the",
"new",
"key",
"."
] | 199d20bbfed70dae8c7d4619d4e0d339ce738b43 | https://github.com/graphql-go/graphql/blob/199d20bbfed70dae8c7d4619d4e0d339ce738b43/definition.go#L1306-L1311 |
160,737 | graphql-go/graphql | definition.go | AsArray | func (p *ResponsePath) AsArray() []interface{} {
if p == nil {
return nil
}
return append(p.Prev.AsArray(), p.Key)
} | go | func (p *ResponsePath) AsArray() []interface{} {
if p == nil {
return nil
}
return append(p.Prev.AsArray(), p.Key)
} | [
"func",
"(",
"p",
"*",
"ResponsePath",
")",
"AsArray",
"(",
")",
"[",
"]",
"interface",
"{",
"}",
"{",
"if",
"p",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"return",
"append",
"(",
"p",
".",
"Prev",
".",
"AsArray",
"(",
")",
",",
"p",... | // AsArray returns an array of path keys. | [
"AsArray",
"returns",
"an",
"array",
"of",
"path",
"keys",
"."
] | 199d20bbfed70dae8c7d4619d4e0d339ce738b43 | https://github.com/graphql-go/graphql/blob/199d20bbfed70dae8c7d4619d4e0d339ce738b43/definition.go#L1314-L1319 |
160,738 | graphql-go/graphql | executor.go | getOperationRootType | func getOperationRootType(schema Schema, operation ast.Definition) (*Object, error) {
if operation == nil {
return nil, errors.New("Can only execute queries, mutations and subscription")
}
switch operation.GetOperation() {
case ast.OperationTypeQuery:
return schema.QueryType(), nil
case ast.OperationTypeMutat... | go | func getOperationRootType(schema Schema, operation ast.Definition) (*Object, error) {
if operation == nil {
return nil, errors.New("Can only execute queries, mutations and subscription")
}
switch operation.GetOperation() {
case ast.OperationTypeQuery:
return schema.QueryType(), nil
case ast.OperationTypeMutat... | [
"func",
"getOperationRootType",
"(",
"schema",
"Schema",
",",
"operation",
"ast",
".",
"Definition",
")",
"(",
"*",
"Object",
",",
"error",
")",
"{",
"if",
"operation",
"==",
"nil",
"{",
"return",
"nil",
",",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",... | // Extracts the root type of the operation from the schema. | [
"Extracts",
"the",
"root",
"type",
"of",
"the",
"operation",
"from",
"the",
"schema",
"."
] | 199d20bbfed70dae8c7d4619d4e0d339ce738b43 | https://github.com/graphql-go/graphql/blob/199d20bbfed70dae8c7d4619d4e0d339ce738b43/executor.go#L193-L237 |
160,739 | graphql-go/graphql | executor.go | executeFieldsSerially | func executeFieldsSerially(p executeFieldsParams) *Result {
if p.Source == nil {
p.Source = map[string]interface{}{}
}
if p.Fields == nil {
p.Fields = map[string][]*ast.Field{}
}
finalResults := make(map[string]interface{}, len(p.Fields))
for responseName, fieldASTs := range p.Fields {
fieldPath := p.Path.... | go | func executeFieldsSerially(p executeFieldsParams) *Result {
if p.Source == nil {
p.Source = map[string]interface{}{}
}
if p.Fields == nil {
p.Fields = map[string][]*ast.Field{}
}
finalResults := make(map[string]interface{}, len(p.Fields))
for responseName, fieldASTs := range p.Fields {
fieldPath := p.Path.... | [
"func",
"executeFieldsSerially",
"(",
"p",
"executeFieldsParams",
")",
"*",
"Result",
"{",
"if",
"p",
".",
"Source",
"==",
"nil",
"{",
"p",
".",
"Source",
"=",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
"{",
"}",
"\n",
"}",
"\n",
"if",
"p",
... | // Implements the "Evaluating selection sets" section of the spec for "write" mode. | [
"Implements",
"the",
"Evaluating",
"selection",
"sets",
"section",
"of",
"the",
"spec",
"for",
"write",
"mode",
"."
] | 199d20bbfed70dae8c7d4619d4e0d339ce738b43 | https://github.com/graphql-go/graphql/blob/199d20bbfed70dae8c7d4619d4e0d339ce738b43/executor.go#L248-L271 |
160,740 | graphql-go/graphql | executor.go | executeFields | func executeFields(p executeFieldsParams) *Result {
finalResults := executeSubFields(p)
dethunkMapWithBreadthFirstTraversal(finalResults)
return &Result{
Data: finalResults,
Errors: p.ExecutionContext.Errors,
}
} | go | func executeFields(p executeFieldsParams) *Result {
finalResults := executeSubFields(p)
dethunkMapWithBreadthFirstTraversal(finalResults)
return &Result{
Data: finalResults,
Errors: p.ExecutionContext.Errors,
}
} | [
"func",
"executeFields",
"(",
"p",
"executeFieldsParams",
")",
"*",
"Result",
"{",
"finalResults",
":=",
"executeSubFields",
"(",
"p",
")",
"\n\n",
"dethunkMapWithBreadthFirstTraversal",
"(",
"finalResults",
")",
"\n\n",
"return",
"&",
"Result",
"{",
"Data",
":",
... | // Implements the "Evaluating selection sets" section of the spec for "read" mode. | [
"Implements",
"the",
"Evaluating",
"selection",
"sets",
"section",
"of",
"the",
"spec",
"for",
"read",
"mode",
"."
] | 199d20bbfed70dae8c7d4619d4e0d339ce738b43 | https://github.com/graphql-go/graphql/blob/199d20bbfed70dae8c7d4619d4e0d339ce738b43/executor.go#L274-L283 |
160,741 | graphql-go/graphql | executor.go | collectFields | func collectFields(p collectFieldsParams) (fields map[string][]*ast.Field) {
// overlying SelectionSet & Fields to fields
if p.SelectionSet == nil {
return p.Fields
}
fields = p.Fields
if fields == nil {
fields = map[string][]*ast.Field{}
}
if p.VisitedFragmentNames == nil {
p.VisitedFragmentNames = map[st... | go | func collectFields(p collectFieldsParams) (fields map[string][]*ast.Field) {
// overlying SelectionSet & Fields to fields
if p.SelectionSet == nil {
return p.Fields
}
fields = p.Fields
if fields == nil {
fields = map[string][]*ast.Field{}
}
if p.VisitedFragmentNames == nil {
p.VisitedFragmentNames = map[st... | [
"func",
"collectFields",
"(",
"p",
"collectFieldsParams",
")",
"(",
"fields",
"map",
"[",
"string",
"]",
"[",
"]",
"*",
"ast",
".",
"Field",
")",
"{",
"// overlying SelectionSet & Fields to fields",
"if",
"p",
".",
"SelectionSet",
"==",
"nil",
"{",
"return",
... | // Given a selectionSet, adds all of the fields in that selection to
// the passed in map of fields, and returns it at the end.
// CollectFields requires the "runtime type" of an object. For a field which
// returns and Interface or Union type, the "runtime type" will be the actual
// Object type returned by that field... | [
"Given",
"a",
"selectionSet",
"adds",
"all",
"of",
"the",
"fields",
"in",
"that",
"selection",
"to",
"the",
"passed",
"in",
"map",
"of",
"fields",
"and",
"returns",
"it",
"at",
"the",
"end",
".",
"CollectFields",
"requires",
"the",
"runtime",
"type",
"of",... | 199d20bbfed70dae8c7d4619d4e0d339ce738b43 | https://github.com/graphql-go/graphql/blob/199d20bbfed70dae8c7d4619d4e0d339ce738b43/executor.go#L408-L476 |
160,742 | graphql-go/graphql | executor.go | shouldIncludeNode | func shouldIncludeNode(eCtx *executionContext, directives []*ast.Directive) bool {
var (
skipAST, includeAST *ast.Directive
argValues map[string]interface{}
)
for _, directive := range directives {
if directive == nil || directive.Name == nil {
continue
}
switch directive.Name.Value {
case S... | go | func shouldIncludeNode(eCtx *executionContext, directives []*ast.Directive) bool {
var (
skipAST, includeAST *ast.Directive
argValues map[string]interface{}
)
for _, directive := range directives {
if directive == nil || directive.Name == nil {
continue
}
switch directive.Name.Value {
case S... | [
"func",
"shouldIncludeNode",
"(",
"eCtx",
"*",
"executionContext",
",",
"directives",
"[",
"]",
"*",
"ast",
".",
"Directive",
")",
"bool",
"{",
"var",
"(",
"skipAST",
",",
"includeAST",
"*",
"ast",
".",
"Directive",
"\n",
"argValues",
"map",
"[",
"string",... | // Determines if a field should be included based on the @include and @skip
// directives, where @skip has higher precedence than @include. | [
"Determines",
"if",
"a",
"field",
"should",
"be",
"included",
"based",
"on",
"the"
] | 199d20bbfed70dae8c7d4619d4e0d339ce738b43 | https://github.com/graphql-go/graphql/blob/199d20bbfed70dae8c7d4619d4e0d339ce738b43/executor.go#L480-L510 |
160,743 | graphql-go/graphql | executor.go | doesFragmentConditionMatch | func doesFragmentConditionMatch(eCtx *executionContext, fragment ast.Node, ttype *Object) bool {
switch fragment := fragment.(type) {
case *ast.FragmentDefinition:
typeConditionAST := fragment.TypeCondition
if typeConditionAST == nil {
return true
}
conditionalType, err := typeFromAST(eCtx.Schema, typeCon... | go | func doesFragmentConditionMatch(eCtx *executionContext, fragment ast.Node, ttype *Object) bool {
switch fragment := fragment.(type) {
case *ast.FragmentDefinition:
typeConditionAST := fragment.TypeCondition
if typeConditionAST == nil {
return true
}
conditionalType, err := typeFromAST(eCtx.Schema, typeCon... | [
"func",
"doesFragmentConditionMatch",
"(",
"eCtx",
"*",
"executionContext",
",",
"fragment",
"ast",
".",
"Node",
",",
"ttype",
"*",
"Object",
")",
"bool",
"{",
"switch",
"fragment",
":=",
"fragment",
".",
"(",
"type",
")",
"{",
"case",
"*",
"ast",
".",
"... | // Determines if a fragment is applicable to the given type. | [
"Determines",
"if",
"a",
"fragment",
"is",
"applicable",
"to",
"the",
"given",
"type",
"."
] | 199d20bbfed70dae8c7d4619d4e0d339ce738b43 | https://github.com/graphql-go/graphql/blob/199d20bbfed70dae8c7d4619d4e0d339ce738b43/executor.go#L513-L561 |
160,744 | graphql-go/graphql | executor.go | resolveField | func resolveField(eCtx *executionContext, parentType *Object, source interface{}, fieldASTs []*ast.Field, path *ResponsePath) (result interface{}, resultState resolveFieldResultState) {
// catch panic from resolveFn
var returnType Output
defer func() (interface{}, resolveFieldResultState) {
if r := recover(); r !=... | go | func resolveField(eCtx *executionContext, parentType *Object, source interface{}, fieldASTs []*ast.Field, path *ResponsePath) (result interface{}, resultState resolveFieldResultState) {
// catch panic from resolveFn
var returnType Output
defer func() (interface{}, resolveFieldResultState) {
if r := recover(); r !=... | [
"func",
"resolveField",
"(",
"eCtx",
"*",
"executionContext",
",",
"parentType",
"*",
"Object",
",",
"source",
"interface",
"{",
"}",
",",
"fieldASTs",
"[",
"]",
"*",
"ast",
".",
"Field",
",",
"path",
"*",
"ResponsePath",
")",
"(",
"result",
"interface",
... | // Resolves the field on the given source object. In particular, this
// figures out the value that the field returns by calling its resolve function,
// then calls completeValue to complete promises, serialize scalars, or execute
// the sub-selection-set for objects. | [
"Resolves",
"the",
"field",
"on",
"the",
"given",
"source",
"object",
".",
"In",
"particular",
"this",
"figures",
"out",
"the",
"value",
"that",
"the",
"field",
"returns",
"by",
"calling",
"its",
"resolve",
"function",
"then",
"calls",
"completeValue",
"to",
... | 199d20bbfed70dae8c7d4619d4e0d339ce738b43 | https://github.com/graphql-go/graphql/blob/199d20bbfed70dae8c7d4619d4e0d339ce738b43/executor.go#L593-L664 |
160,745 | graphql-go/graphql | executor.go | completeObjectValue | func completeObjectValue(eCtx *executionContext, returnType *Object, fieldASTs []*ast.Field, info ResolveInfo, path *ResponsePath, result interface{}) interface{} {
// If there is an isTypeOf predicate function, call it with the
// current result. If isTypeOf returns false, then raise an error rather
// than contin... | go | func completeObjectValue(eCtx *executionContext, returnType *Object, fieldASTs []*ast.Field, info ResolveInfo, path *ResponsePath, result interface{}) interface{} {
// If there is an isTypeOf predicate function, call it with the
// current result. If isTypeOf returns false, then raise an error rather
// than contin... | [
"func",
"completeObjectValue",
"(",
"eCtx",
"*",
"executionContext",
",",
"returnType",
"*",
"Object",
",",
"fieldASTs",
"[",
"]",
"*",
"ast",
".",
"Field",
",",
"info",
"ResolveInfo",
",",
"path",
"*",
"ResponsePath",
",",
"result",
"interface",
"{",
"}",
... | // completeObjectValue complete an Object value by executing all sub-selections. | [
"completeObjectValue",
"complete",
"an",
"Object",
"value",
"by",
"executing",
"all",
"sub",
"-",
"selections",
"."
] | 199d20bbfed70dae8c7d4619d4e0d339ce738b43 | https://github.com/graphql-go/graphql/blob/199d20bbfed70dae8c7d4619d4e0d339ce738b43/executor.go#L820-L865 |
160,746 | graphql-go/graphql | executor.go | completeListValue | func completeListValue(eCtx *executionContext, returnType *List, fieldASTs []*ast.Field, info ResolveInfo, path *ResponsePath, result interface{}) interface{} {
resultVal := reflect.ValueOf(result)
if resultVal.Kind() == reflect.Ptr {
resultVal = resultVal.Elem()
}
parentTypeName := ""
if info.ParentType != nil ... | go | func completeListValue(eCtx *executionContext, returnType *List, fieldASTs []*ast.Field, info ResolveInfo, path *ResponsePath, result interface{}) interface{} {
resultVal := reflect.ValueOf(result)
if resultVal.Kind() == reflect.Ptr {
resultVal = resultVal.Elem()
}
parentTypeName := ""
if info.ParentType != nil ... | [
"func",
"completeListValue",
"(",
"eCtx",
"*",
"executionContext",
",",
"returnType",
"*",
"List",
",",
"fieldASTs",
"[",
"]",
"*",
"ast",
".",
"Field",
",",
"info",
"ResolveInfo",
",",
"path",
"*",
"ResponsePath",
",",
"result",
"interface",
"{",
"}",
")"... | // completeListValue complete a list value by completing each item in the list with the inner type | [
"completeListValue",
"complete",
"a",
"list",
"value",
"by",
"completing",
"each",
"item",
"in",
"the",
"list",
"with",
"the",
"inner",
"type"
] | 199d20bbfed70dae8c7d4619d4e0d339ce738b43 | https://github.com/graphql-go/graphql/blob/199d20bbfed70dae8c7d4619d4e0d339ce738b43/executor.go#L877-L904 |
160,747 | graphql-go/graphql | executor.go | defaultResolveTypeFn | func defaultResolveTypeFn(p ResolveTypeParams, abstractType Abstract) *Object {
possibleTypes := p.Info.Schema.PossibleTypes(abstractType)
for _, possibleType := range possibleTypes {
if possibleType.IsTypeOf == nil {
continue
}
isTypeOfParams := IsTypeOfParams{
Value: p.Value,
Info: p.Info,
Co... | go | func defaultResolveTypeFn(p ResolveTypeParams, abstractType Abstract) *Object {
possibleTypes := p.Info.Schema.PossibleTypes(abstractType)
for _, possibleType := range possibleTypes {
if possibleType.IsTypeOf == nil {
continue
}
isTypeOfParams := IsTypeOfParams{
Value: p.Value,
Info: p.Info,
Co... | [
"func",
"defaultResolveTypeFn",
"(",
"p",
"ResolveTypeParams",
",",
"abstractType",
"Abstract",
")",
"*",
"Object",
"{",
"possibleTypes",
":=",
"p",
".",
"Info",
".",
"Schema",
".",
"PossibleTypes",
"(",
"abstractType",
")",
"\n",
"for",
"_",
",",
"possibleTyp... | // defaultResolveTypeFn If a resolveType function is not given, then a default resolve behavior is
// used which tests each possible type for the abstract type by calling
// isTypeOf for the object being coerced, returning the first type that matches. | [
"defaultResolveTypeFn",
"If",
"a",
"resolveType",
"function",
"is",
"not",
"given",
"then",
"a",
"default",
"resolve",
"behavior",
"is",
"used",
"which",
"tests",
"each",
"possible",
"type",
"for",
"the",
"abstract",
"type",
"by",
"calling",
"isTypeOf",
"for",
... | 199d20bbfed70dae8c7d4619d4e0d339ce738b43 | https://github.com/graphql-go/graphql/blob/199d20bbfed70dae8c7d4619d4e0d339ce738b43/executor.go#L909-L925 |
160,748 | graphql-go/graphql | extensions.go | handleExtensionsInits | func handleExtensionsInits(p *Params) gqlerrors.FormattedErrors {
errs := gqlerrors.FormattedErrors{}
for _, ext := range p.Schema.extensions {
func() {
// catch panic from an extension init fn
defer func() {
if r := recover(); r != nil {
errs = append(errs, gqlerrors.FormatError(fmt.Errorf("%s.Init:... | go | func handleExtensionsInits(p *Params) gqlerrors.FormattedErrors {
errs := gqlerrors.FormattedErrors{}
for _, ext := range p.Schema.extensions {
func() {
// catch panic from an extension init fn
defer func() {
if r := recover(); r != nil {
errs = append(errs, gqlerrors.FormatError(fmt.Errorf("%s.Init:... | [
"func",
"handleExtensionsInits",
"(",
"p",
"*",
"Params",
")",
"gqlerrors",
".",
"FormattedErrors",
"{",
"errs",
":=",
"gqlerrors",
".",
"FormattedErrors",
"{",
"}",
"\n",
"for",
"_",
",",
"ext",
":=",
"range",
"p",
".",
"Schema",
".",
"extensions",
"{",
... | // handleExtensionsInits handles all the init functions for all the extensions in the schema | [
"handleExtensionsInits",
"handles",
"all",
"the",
"init",
"functions",
"for",
"all",
"the",
"extensions",
"in",
"the",
"schema"
] | 199d20bbfed70dae8c7d4619d4e0d339ce738b43 | https://github.com/graphql-go/graphql/blob/199d20bbfed70dae8c7d4619d4e0d339ce738b43/extensions.go#L60-L75 |
160,749 | graphql-go/graphql | extensions.go | handleExtensionsParseDidStart | func handleExtensionsParseDidStart(p *Params) ([]gqlerrors.FormattedError, parseFinishFuncHandler) {
fs := map[string]ParseFinishFunc{}
errs := gqlerrors.FormattedErrors{}
for _, ext := range p.Schema.extensions {
var (
ctx context.Context
finishFn ParseFinishFunc
)
// catch panic from an extension'... | go | func handleExtensionsParseDidStart(p *Params) ([]gqlerrors.FormattedError, parseFinishFuncHandler) {
fs := map[string]ParseFinishFunc{}
errs := gqlerrors.FormattedErrors{}
for _, ext := range p.Schema.extensions {
var (
ctx context.Context
finishFn ParseFinishFunc
)
// catch panic from an extension'... | [
"func",
"handleExtensionsParseDidStart",
"(",
"p",
"*",
"Params",
")",
"(",
"[",
"]",
"gqlerrors",
".",
"FormattedError",
",",
"parseFinishFuncHandler",
")",
"{",
"fs",
":=",
"map",
"[",
"string",
"]",
"ParseFinishFunc",
"{",
"}",
"\n",
"errs",
":=",
"gqlerr... | // handleExtensionsParseDidStart runs the ParseDidStart functions for each extension | [
"handleExtensionsParseDidStart",
"runs",
"the",
"ParseDidStart",
"functions",
"for",
"each",
"extension"
] | 199d20bbfed70dae8c7d4619d4e0d339ce738b43 | https://github.com/graphql-go/graphql/blob/199d20bbfed70dae8c7d4619d4e0d339ce738b43/extensions.go#L78-L114 |
160,750 | graphql-go/graphql | extensions.go | handleExtensionsValidationDidStart | func handleExtensionsValidationDidStart(p *Params) ([]gqlerrors.FormattedError, validationFinishFuncHandler) {
fs := map[string]ValidationFinishFunc{}
errs := gqlerrors.FormattedErrors{}
for _, ext := range p.Schema.extensions {
var (
ctx context.Context
finishFn ValidationFinishFunc
)
// catch pani... | go | func handleExtensionsValidationDidStart(p *Params) ([]gqlerrors.FormattedError, validationFinishFuncHandler) {
fs := map[string]ValidationFinishFunc{}
errs := gqlerrors.FormattedErrors{}
for _, ext := range p.Schema.extensions {
var (
ctx context.Context
finishFn ValidationFinishFunc
)
// catch pani... | [
"func",
"handleExtensionsValidationDidStart",
"(",
"p",
"*",
"Params",
")",
"(",
"[",
"]",
"gqlerrors",
".",
"FormattedError",
",",
"validationFinishFuncHandler",
")",
"{",
"fs",
":=",
"map",
"[",
"string",
"]",
"ValidationFinishFunc",
"{",
"}",
"\n",
"errs",
... | // handleExtensionsValidationDidStart notifies the extensions about the start of the validation process | [
"handleExtensionsValidationDidStart",
"notifies",
"the",
"extensions",
"about",
"the",
"start",
"of",
"the",
"validation",
"process"
] | 199d20bbfed70dae8c7d4619d4e0d339ce738b43 | https://github.com/graphql-go/graphql/blob/199d20bbfed70dae8c7d4619d4e0d339ce738b43/extensions.go#L117-L153 |
160,751 | graphql-go/graphql | extensions.go | handleExtensionsExecutionDidStart | func handleExtensionsExecutionDidStart(p *ExecuteParams) ([]gqlerrors.FormattedError, executionFinishFuncHandler) {
fs := map[string]ExecutionFinishFunc{}
errs := gqlerrors.FormattedErrors{}
for _, ext := range p.Schema.extensions {
var (
ctx context.Context
finishFn ExecutionFinishFunc
)
// catch p... | go | func handleExtensionsExecutionDidStart(p *ExecuteParams) ([]gqlerrors.FormattedError, executionFinishFuncHandler) {
fs := map[string]ExecutionFinishFunc{}
errs := gqlerrors.FormattedErrors{}
for _, ext := range p.Schema.extensions {
var (
ctx context.Context
finishFn ExecutionFinishFunc
)
// catch p... | [
"func",
"handleExtensionsExecutionDidStart",
"(",
"p",
"*",
"ExecuteParams",
")",
"(",
"[",
"]",
"gqlerrors",
".",
"FormattedError",
",",
"executionFinishFuncHandler",
")",
"{",
"fs",
":=",
"map",
"[",
"string",
"]",
"ExecutionFinishFunc",
"{",
"}",
"\n",
"errs"... | // handleExecutionDidStart handles the ExecutionDidStart functions | [
"handleExecutionDidStart",
"handles",
"the",
"ExecutionDidStart",
"functions"
] | 199d20bbfed70dae8c7d4619d4e0d339ce738b43 | https://github.com/graphql-go/graphql/blob/199d20bbfed70dae8c7d4619d4e0d339ce738b43/extensions.go#L156-L192 |
160,752 | graphql-go/graphql | extensions.go | handleExtensionsResolveFieldDidStart | func handleExtensionsResolveFieldDidStart(exts []Extension, p *executionContext, i *ResolveInfo) ([]gqlerrors.FormattedError, resolveFieldFinishFuncHandler) {
fs := map[string]ResolveFieldFinishFunc{}
errs := gqlerrors.FormattedErrors{}
for _, ext := range p.Schema.extensions {
var (
ctx context.Context
... | go | func handleExtensionsResolveFieldDidStart(exts []Extension, p *executionContext, i *ResolveInfo) ([]gqlerrors.FormattedError, resolveFieldFinishFuncHandler) {
fs := map[string]ResolveFieldFinishFunc{}
errs := gqlerrors.FormattedErrors{}
for _, ext := range p.Schema.extensions {
var (
ctx context.Context
... | [
"func",
"handleExtensionsResolveFieldDidStart",
"(",
"exts",
"[",
"]",
"Extension",
",",
"p",
"*",
"executionContext",
",",
"i",
"*",
"ResolveInfo",
")",
"(",
"[",
"]",
"gqlerrors",
".",
"FormattedError",
",",
"resolveFieldFinishFuncHandler",
")",
"{",
"fs",
":=... | // handleResolveFieldDidStart handles the notification of the extensions about the start of a resolve function | [
"handleResolveFieldDidStart",
"handles",
"the",
"notification",
"of",
"the",
"extensions",
"about",
"the",
"start",
"of",
"a",
"resolve",
"function"
] | 199d20bbfed70dae8c7d4619d4e0d339ce738b43 | https://github.com/graphql-go/graphql/blob/199d20bbfed70dae8c7d4619d4e0d339ce738b43/extensions.go#L195-L231 |
160,753 | graphql-go/graphql | validator.go | VisitUsingRules | func VisitUsingRules(schema *Schema, typeInfo *TypeInfo, astDoc *ast.Document, rules []ValidationRuleFn) []gqlerrors.FormattedError {
context := NewValidationContext(schema, astDoc, typeInfo)
visitors := []*visitor.VisitorOptions{}
for _, rule := range rules {
instance := rule(context)
visitors = append(visito... | go | func VisitUsingRules(schema *Schema, typeInfo *TypeInfo, astDoc *ast.Document, rules []ValidationRuleFn) []gqlerrors.FormattedError {
context := NewValidationContext(schema, astDoc, typeInfo)
visitors := []*visitor.VisitorOptions{}
for _, rule := range rules {
instance := rule(context)
visitors = append(visito... | [
"func",
"VisitUsingRules",
"(",
"schema",
"*",
"Schema",
",",
"typeInfo",
"*",
"TypeInfo",
",",
"astDoc",
"*",
"ast",
".",
"Document",
",",
"rules",
"[",
"]",
"ValidationRuleFn",
")",
"[",
"]",
"gqlerrors",
".",
"FormattedError",
"{",
"context",
":=",
"New... | // VisitUsingRules This uses a specialized visitor which runs multiple visitors in parallel,
// while maintaining the visitor skip and break API.
//
// @internal
// Had to expose it to unit test experimental customizable validation feature,
// but not meant for public consumption | [
"VisitUsingRules",
"This",
"uses",
"a",
"specialized",
"visitor",
"which",
"runs",
"multiple",
"visitors",
"in",
"parallel",
"while",
"maintaining",
"the",
"visitor",
"skip",
"and",
"break",
"API",
"."
] | 199d20bbfed70dae8c7d4619d4e0d339ce738b43 | https://github.com/graphql-go/graphql/blob/199d20bbfed70dae8c7d4619d4e0d339ce738b43/validator.go#L59-L72 |
160,754 | graphql-go/graphql | rules_overlapping_fields_can_be_merged.go | findConflictsWithinSelectionSet | func (rule *overlappingFieldsCanBeMergedRule) findConflictsWithinSelectionSet(parentType Named, selectionSet *ast.SelectionSet) []conflict {
conflicts := []conflict{}
fieldsInfo := rule.getFieldsAndFragmentNames(parentType, selectionSet)
// (A) Find find all conflicts "within" the fields of this selection set.
//... | go | func (rule *overlappingFieldsCanBeMergedRule) findConflictsWithinSelectionSet(parentType Named, selectionSet *ast.SelectionSet) []conflict {
conflicts := []conflict{}
fieldsInfo := rule.getFieldsAndFragmentNames(parentType, selectionSet)
// (A) Find find all conflicts "within" the fields of this selection set.
//... | [
"func",
"(",
"rule",
"*",
"overlappingFieldsCanBeMergedRule",
")",
"findConflictsWithinSelectionSet",
"(",
"parentType",
"Named",
",",
"selectionSet",
"*",
"ast",
".",
"SelectionSet",
")",
"[",
"]",
"conflict",
"{",
"conflicts",
":=",
"[",
"]",
"conflict",
"{",
... | // Find all conflicts found "within" a selection set, including those found
// via spreading in fragments. Called when visiting each SelectionSet in the
// GraphQL Document. | [
"Find",
"all",
"conflicts",
"found",
"within",
"a",
"selection",
"set",
"including",
"those",
"found",
"via",
"spreading",
"in",
"fragments",
".",
"Called",
"when",
"visiting",
"each",
"SelectionSet",
"in",
"the",
"GraphQL",
"Document",
"."
] | 199d20bbfed70dae8c7d4619d4e0d339ce738b43 | https://github.com/graphql-go/graphql/blob/199d20bbfed70dae8c7d4619d4e0d339ce738b43/rules_overlapping_fields_can_be_merged.go#L166-L190 |
160,755 | graphql-go/graphql | rules_overlapping_fields_can_be_merged.go | collectConflictsBetweenFieldsAndFragment | func (rule *overlappingFieldsCanBeMergedRule) collectConflictsBetweenFieldsAndFragment(conflicts []conflict, areMutuallyExclusive bool, fieldsInfo *fieldsAndFragmentNames, fragmentName string) []conflict {
fragment := rule.context.Fragment(fragmentName)
if fragment == nil {
return conflicts
}
fieldsInfo2 := rule... | go | func (rule *overlappingFieldsCanBeMergedRule) collectConflictsBetweenFieldsAndFragment(conflicts []conflict, areMutuallyExclusive bool, fieldsInfo *fieldsAndFragmentNames, fragmentName string) []conflict {
fragment := rule.context.Fragment(fragmentName)
if fragment == nil {
return conflicts
}
fieldsInfo2 := rule... | [
"func",
"(",
"rule",
"*",
"overlappingFieldsCanBeMergedRule",
")",
"collectConflictsBetweenFieldsAndFragment",
"(",
"conflicts",
"[",
"]",
"conflict",
",",
"areMutuallyExclusive",
"bool",
",",
"fieldsInfo",
"*",
"fieldsAndFragmentNames",
",",
"fragmentName",
"string",
")"... | // Collect all conflicts found between a set of fields and a fragment reference
// including via spreading in any nested fragments. | [
"Collect",
"all",
"conflicts",
"found",
"between",
"a",
"set",
"of",
"fields",
"and",
"a",
"fragment",
"reference",
"including",
"via",
"spreading",
"in",
"any",
"nested",
"fragments",
"."
] | 199d20bbfed70dae8c7d4619d4e0d339ce738b43 | https://github.com/graphql-go/graphql/blob/199d20bbfed70dae8c7d4619d4e0d339ce738b43/rules_overlapping_fields_can_be_merged.go#L194-L214 |
160,756 | graphql-go/graphql | rules_overlapping_fields_can_be_merged.go | collectConflictsBetweenFragments | func (rule *overlappingFieldsCanBeMergedRule) collectConflictsBetweenFragments(conflicts []conflict, areMutuallyExclusive bool, fragmentName1 string, fragmentName2 string) []conflict {
fragment1 := rule.context.Fragment(fragmentName1)
fragment2 := rule.context.Fragment(fragmentName2)
if fragment1 == nil || fragment... | go | func (rule *overlappingFieldsCanBeMergedRule) collectConflictsBetweenFragments(conflicts []conflict, areMutuallyExclusive bool, fragmentName1 string, fragmentName2 string) []conflict {
fragment1 := rule.context.Fragment(fragmentName1)
fragment2 := rule.context.Fragment(fragmentName2)
if fragment1 == nil || fragment... | [
"func",
"(",
"rule",
"*",
"overlappingFieldsCanBeMergedRule",
")",
"collectConflictsBetweenFragments",
"(",
"conflicts",
"[",
"]",
"conflict",
",",
"areMutuallyExclusive",
"bool",
",",
"fragmentName1",
"string",
",",
"fragmentName2",
"string",
")",
"[",
"]",
"conflict... | // Collect all conflicts found between two fragments, including via spreading in
// any nested fragments. | [
"Collect",
"all",
"conflicts",
"found",
"between",
"two",
"fragments",
"including",
"via",
"spreading",
"in",
"any",
"nested",
"fragments",
"."
] | 199d20bbfed70dae8c7d4619d4e0d339ce738b43 | https://github.com/graphql-go/graphql/blob/199d20bbfed70dae8c7d4619d4e0d339ce738b43/rules_overlapping_fields_can_be_merged.go#L218-L257 |
160,757 | graphql-go/graphql | rules_overlapping_fields_can_be_merged.go | findConflictsBetweenSubSelectionSets | func (rule *overlappingFieldsCanBeMergedRule) findConflictsBetweenSubSelectionSets(areMutuallyExclusive bool, parentType1 Named, selectionSet1 *ast.SelectionSet, parentType2 Named, selectionSet2 *ast.SelectionSet) []conflict {
conflicts := []conflict{}
fieldsInfo1 := rule.getFieldsAndFragmentNames(parentType1, selec... | go | func (rule *overlappingFieldsCanBeMergedRule) findConflictsBetweenSubSelectionSets(areMutuallyExclusive bool, parentType1 Named, selectionSet1 *ast.SelectionSet, parentType2 Named, selectionSet2 *ast.SelectionSet) []conflict {
conflicts := []conflict{}
fieldsInfo1 := rule.getFieldsAndFragmentNames(parentType1, selec... | [
"func",
"(",
"rule",
"*",
"overlappingFieldsCanBeMergedRule",
")",
"findConflictsBetweenSubSelectionSets",
"(",
"areMutuallyExclusive",
"bool",
",",
"parentType1",
"Named",
",",
"selectionSet1",
"*",
"ast",
".",
"SelectionSet",
",",
"parentType2",
"Named",
",",
"selecti... | // Find all conflicts found between two selection sets, including those found
// via spreading in fragments. Called when determining if conflicts exist
// between the sub-fields of two overlapping fields. | [
"Find",
"all",
"conflicts",
"found",
"between",
"two",
"selection",
"sets",
"including",
"those",
"found",
"via",
"spreading",
"in",
"fragments",
".",
"Called",
"when",
"determining",
"if",
"conflicts",
"exist",
"between",
"the",
"sub",
"-",
"fields",
"of",
"t... | 199d20bbfed70dae8c7d4619d4e0d339ce738b43 | https://github.com/graphql-go/graphql/blob/199d20bbfed70dae8c7d4619d4e0d339ce738b43/rules_overlapping_fields_can_be_merged.go#L262-L292 |
160,758 | graphql-go/graphql | rules_overlapping_fields_can_be_merged.go | collectConflictsWithin | func (rule *overlappingFieldsCanBeMergedRule) collectConflictsWithin(conflicts []conflict, fieldsInfo *fieldsAndFragmentNames) []conflict {
// A field map is a keyed collection, where each key represents a response
// name and the value at that key is a list of all fields which provide that
// response name. For eve... | go | func (rule *overlappingFieldsCanBeMergedRule) collectConflictsWithin(conflicts []conflict, fieldsInfo *fieldsAndFragmentNames) []conflict {
// A field map is a keyed collection, where each key represents a response
// name and the value at that key is a list of all fields which provide that
// response name. For eve... | [
"func",
"(",
"rule",
"*",
"overlappingFieldsCanBeMergedRule",
")",
"collectConflictsWithin",
"(",
"conflicts",
"[",
"]",
"conflict",
",",
"fieldsInfo",
"*",
"fieldsAndFragmentNames",
")",
"[",
"]",
"conflict",
"{",
"// A field map is a keyed collection, where each key repre... | // Collect all Conflicts "within" one collection of fields. | [
"Collect",
"all",
"Conflicts",
"within",
"one",
"collection",
"of",
"fields",
"."
] | 199d20bbfed70dae8c7d4619d4e0d339ce738b43 | https://github.com/graphql-go/graphql/blob/199d20bbfed70dae8c7d4619d4e0d339ce738b43/rules_overlapping_fields_can_be_merged.go#L295-L323 |
160,759 | graphql-go/graphql | rules_overlapping_fields_can_be_merged.go | collectConflictsBetween | func (rule *overlappingFieldsCanBeMergedRule) collectConflictsBetween(conflicts []conflict, parentFieldsAreMutuallyExclusive bool,
fieldsInfo1 *fieldsAndFragmentNames,
fieldsInfo2 *fieldsAndFragmentNames) []conflict {
// A field map is a keyed collection, where each key represents a response
// name and the value a... | go | func (rule *overlappingFieldsCanBeMergedRule) collectConflictsBetween(conflicts []conflict, parentFieldsAreMutuallyExclusive bool,
fieldsInfo1 *fieldsAndFragmentNames,
fieldsInfo2 *fieldsAndFragmentNames) []conflict {
// A field map is a keyed collection, where each key represents a response
// name and the value a... | [
"func",
"(",
"rule",
"*",
"overlappingFieldsCanBeMergedRule",
")",
"collectConflictsBetween",
"(",
"conflicts",
"[",
"]",
"conflict",
",",
"parentFieldsAreMutuallyExclusive",
"bool",
",",
"fieldsInfo1",
"*",
"fieldsAndFragmentNames",
",",
"fieldsInfo2",
"*",
"fieldsAndFra... | // Collect all Conflicts between two collections of fields. This is similar to,
// but different from the `collectConflictsWithin` function above. This check
// assumes that `collectConflictsWithin` has already been called on each
// provided collection of fields. This is true because this validator traverses
// each i... | [
"Collect",
"all",
"Conflicts",
"between",
"two",
"collections",
"of",
"fields",
".",
"This",
"is",
"similar",
"to",
"but",
"different",
"from",
"the",
"collectConflictsWithin",
"function",
"above",
".",
"This",
"check",
"assumes",
"that",
"collectConflictsWithin",
... | 199d20bbfed70dae8c7d4619d4e0d339ce738b43 | https://github.com/graphql-go/graphql/blob/199d20bbfed70dae8c7d4619d4e0d339ce738b43/rules_overlapping_fields_can_be_merged.go#L330-L354 |
160,760 | graphql-go/graphql | rules_overlapping_fields_can_be_merged.go | findConflict | func (rule *overlappingFieldsCanBeMergedRule) findConflict(parentFieldsAreMutuallyExclusive bool, responseName string, field *fieldDefPair, field2 *fieldDefPair) *conflict {
parentType1 := field.ParentType
ast1 := field.Field
def1 := field.FieldDef
parentType2 := field2.ParentType
ast2 := field2.Field
def2 := f... | go | func (rule *overlappingFieldsCanBeMergedRule) findConflict(parentFieldsAreMutuallyExclusive bool, responseName string, field *fieldDefPair, field2 *fieldDefPair) *conflict {
parentType1 := field.ParentType
ast1 := field.Field
def1 := field.FieldDef
parentType2 := field2.ParentType
ast2 := field2.Field
def2 := f... | [
"func",
"(",
"rule",
"*",
"overlappingFieldsCanBeMergedRule",
")",
"findConflict",
"(",
"parentFieldsAreMutuallyExclusive",
"bool",
",",
"responseName",
"string",
",",
"field",
"*",
"fieldDefPair",
",",
"field2",
"*",
"fieldDefPair",
")",
"*",
"conflict",
"{",
"pare... | // findConflict Determines if there is a conflict between two particular fields. | [
"findConflict",
"Determines",
"if",
"there",
"is",
"a",
"conflict",
"between",
"two",
"particular",
"fields",
"."
] | 199d20bbfed70dae8c7d4619d4e0d339ce738b43 | https://github.com/graphql-go/graphql/blob/199d20bbfed70dae8c7d4619d4e0d339ce738b43/rules_overlapping_fields_can_be_merged.go#L357-L445 |
160,761 | graphql-go/graphql | rules_overlapping_fields_can_be_merged.go | doTypesConflict | func doTypesConflict(type1 Output, type2 Output) bool {
if type1, ok := type1.(*List); ok {
if type2, ok := type2.(*List); ok {
return doTypesConflict(type1.OfType, type2.OfType)
}
return true
}
if type2, ok := type2.(*List); ok {
if type1, ok := type1.(*List); ok {
return doTypesConflict(type1.OfType,... | go | func doTypesConflict(type1 Output, type2 Output) bool {
if type1, ok := type1.(*List); ok {
if type2, ok := type2.(*List); ok {
return doTypesConflict(type1.OfType, type2.OfType)
}
return true
}
if type2, ok := type2.(*List); ok {
if type1, ok := type1.(*List); ok {
return doTypesConflict(type1.OfType,... | [
"func",
"doTypesConflict",
"(",
"type1",
"Output",
",",
"type2",
"Output",
")",
"bool",
"{",
"if",
"type1",
",",
"ok",
":=",
"type1",
".",
"(",
"*",
"List",
")",
";",
"ok",
"{",
"if",
"type2",
",",
"ok",
":=",
"type2",
".",
"(",
"*",
"List",
")",... | // Two types conflict if both types could not apply to a value simultaneously.
// Composite types are ignored as their individual field types will be compared
// later recursively. However List and Non-Null types must match. | [
"Two",
"types",
"conflict",
"if",
"both",
"types",
"could",
"not",
"apply",
"to",
"a",
"value",
"simultaneously",
".",
"Composite",
"types",
"are",
"ignored",
"as",
"their",
"individual",
"field",
"types",
"will",
"be",
"compared",
"later",
"recursively",
".",... | 199d20bbfed70dae8c7d4619d4e0d339ce738b43 | https://github.com/graphql-go/graphql/blob/199d20bbfed70dae8c7d4619d4e0d339ce738b43/rules_overlapping_fields_can_be_merged.go#L653-L682 |
160,762 | graphql-go/graphql | rules_overlapping_fields_can_be_merged.go | subfieldConflicts | func subfieldConflicts(conflicts []conflict, responseName string, ast1 *ast.Field, ast2 *ast.Field) *conflict {
if len(conflicts) > 0 {
conflictReasons := []conflictReason{}
conflictFieldsLeft := []ast.Node{ast1}
conflictFieldsRight := []ast.Node{ast2}
for _, c := range conflicts {
conflictReasons = append(... | go | func subfieldConflicts(conflicts []conflict, responseName string, ast1 *ast.Field, ast2 *ast.Field) *conflict {
if len(conflicts) > 0 {
conflictReasons := []conflictReason{}
conflictFieldsLeft := []ast.Node{ast1}
conflictFieldsRight := []ast.Node{ast2}
for _, c := range conflicts {
conflictReasons = append(... | [
"func",
"subfieldConflicts",
"(",
"conflicts",
"[",
"]",
"conflict",
",",
"responseName",
"string",
",",
"ast1",
"*",
"ast",
".",
"Field",
",",
"ast2",
"*",
"ast",
".",
"Field",
")",
"*",
"conflict",
"{",
"if",
"len",
"(",
"conflicts",
")",
">",
"0",
... | // subfieldConflicts Given a series of Conflicts which occurred between two sub-fields, generate a single Conflict. | [
"subfieldConflicts",
"Given",
"a",
"series",
"of",
"Conflicts",
"which",
"occurred",
"between",
"two",
"sub",
"-",
"fields",
"generate",
"a",
"single",
"Conflict",
"."
] | 199d20bbfed70dae8c7d4619d4e0d339ce738b43 | https://github.com/graphql-go/graphql/blob/199d20bbfed70dae8c7d4619d4e0d339ce738b43/rules_overlapping_fields_can_be_merged.go#L685-L706 |
160,763 | graphql-go/graphql | type_info.go | DefaultTypeInfoFieldDef | func DefaultTypeInfoFieldDef(schema *Schema, parentType Type, fieldAST *ast.Field) *FieldDefinition {
name := ""
if fieldAST.Name != nil {
name = fieldAST.Name.Value
}
if name == SchemaMetaFieldDef.Name &&
schema.QueryType() == parentType {
return SchemaMetaFieldDef
}
if name == TypeMetaFieldDef.Name &&
s... | go | func DefaultTypeInfoFieldDef(schema *Schema, parentType Type, fieldAST *ast.Field) *FieldDefinition {
name := ""
if fieldAST.Name != nil {
name = fieldAST.Name.Value
}
if name == SchemaMetaFieldDef.Name &&
schema.QueryType() == parentType {
return SchemaMetaFieldDef
}
if name == TypeMetaFieldDef.Name &&
s... | [
"func",
"DefaultTypeInfoFieldDef",
"(",
"schema",
"*",
"Schema",
",",
"parentType",
"Type",
",",
"fieldAST",
"*",
"ast",
".",
"Field",
")",
"*",
"FieldDefinition",
"{",
"name",
":=",
"\"",
"\"",
"\n",
"if",
"fieldAST",
".",
"Name",
"!=",
"nil",
"{",
"nam... | // DefaultTypeInfoFieldDef Not exactly the same as the executor's definition of FieldDef, in this
// statically evaluated environment we do not always have an Object type,
// and need to handle Interface and Union types. | [
"DefaultTypeInfoFieldDef",
"Not",
"exactly",
"the",
"same",
"as",
"the",
"executor",
"s",
"definition",
"of",
"FieldDef",
"in",
"this",
"statically",
"evaluated",
"environment",
"we",
"do",
"not",
"always",
"have",
"an",
"Object",
"type",
"and",
"need",
"to",
... | 199d20bbfed70dae8c7d4619d4e0d339ce738b43 | https://github.com/graphql-go/graphql/blob/199d20bbfed70dae8c7d4619d4e0d339ce738b43/type_info.go#L236-L270 |
160,764 | graphql-go/graphql | gqlerrors/located.go | NewLocatedError | func NewLocatedError(err interface{}, nodes []ast.Node) *Error {
var origError error
message := "An unknown error occurred."
if err, ok := err.(error); ok {
message = err.Error()
origError = err
}
if err, ok := err.(string); ok {
message = err
origError = errors.New(err)
}
stack := message
return NewErr... | go | func NewLocatedError(err interface{}, nodes []ast.Node) *Error {
var origError error
message := "An unknown error occurred."
if err, ok := err.(error); ok {
message = err.Error()
origError = err
}
if err, ok := err.(string); ok {
message = err
origError = errors.New(err)
}
stack := message
return NewErr... | [
"func",
"NewLocatedError",
"(",
"err",
"interface",
"{",
"}",
",",
"nodes",
"[",
"]",
"ast",
".",
"Node",
")",
"*",
"Error",
"{",
"var",
"origError",
"error",
"\n",
"message",
":=",
"\"",
"\"",
"\n",
"if",
"err",
",",
"ok",
":=",
"err",
".",
"(",
... | // NewLocatedError creates a graphql.Error with location info
// @deprecated 0.4.18
// Already exists in `graphql.NewLocatedError()` | [
"NewLocatedError",
"creates",
"a",
"graphql",
".",
"Error",
"with",
"location",
"info"
] | 199d20bbfed70dae8c7d4619d4e0d339ce738b43 | https://github.com/graphql-go/graphql/blob/199d20bbfed70dae8c7d4619d4e0d339ce738b43/gqlerrors/located.go#L11-L31 |
160,765 | graphql-go/graphql | examples/http/main.go | importJSONDataFromFile | func importJSONDataFromFile(fileName string, result interface{}) (isOK bool) {
isOK = true
content, err := ioutil.ReadFile(fileName)
if err != nil {
fmt.Print("Error:", err)
isOK = false
}
err = json.Unmarshal(content, result)
if err != nil {
isOK = false
fmt.Print("Error:", err)
}
return
} | go | func importJSONDataFromFile(fileName string, result interface{}) (isOK bool) {
isOK = true
content, err := ioutil.ReadFile(fileName)
if err != nil {
fmt.Print("Error:", err)
isOK = false
}
err = json.Unmarshal(content, result)
if err != nil {
isOK = false
fmt.Print("Error:", err)
}
return
} | [
"func",
"importJSONDataFromFile",
"(",
"fileName",
"string",
",",
"result",
"interface",
"{",
"}",
")",
"(",
"isOK",
"bool",
")",
"{",
"isOK",
"=",
"true",
"\n",
"content",
",",
"err",
":=",
"ioutil",
".",
"ReadFile",
"(",
"fileName",
")",
"\n",
"if",
... | //Helper function to import json from file to map | [
"Helper",
"function",
"to",
"import",
"json",
"from",
"file",
"to",
"map"
] | 199d20bbfed70dae8c7d4619d4e0d339ce738b43 | https://github.com/graphql-go/graphql/blob/199d20bbfed70dae8c7d4619d4e0d339ce738b43/examples/http/main.go#L101-L114 |
160,766 | graphql-go/graphql | language/parser/parser.go | parseName | func parseName(parser *Parser) (*ast.Name, error) {
token, err := expect(parser, lexer.NAME)
if err != nil {
return nil, err
}
return ast.NewName(&ast.Name{
Value: token.Value,
Loc: loc(parser, token.Start),
}), nil
} | go | func parseName(parser *Parser) (*ast.Name, error) {
token, err := expect(parser, lexer.NAME)
if err != nil {
return nil, err
}
return ast.NewName(&ast.Name{
Value: token.Value,
Loc: loc(parser, token.Start),
}), nil
} | [
"func",
"parseName",
"(",
"parser",
"*",
"Parser",
")",
"(",
"*",
"ast",
".",
"Name",
",",
"error",
")",
"{",
"token",
",",
"err",
":=",
"expect",
"(",
"parser",
",",
"lexer",
".",
"NAME",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil"... | // Converts a name lex token into a name parse node. | [
"Converts",
"a",
"name",
"lex",
"token",
"into",
"a",
"name",
"parse",
"node",
"."
] | 199d20bbfed70dae8c7d4619d4e0d339ce738b43 | https://github.com/graphql-go/graphql/blob/199d20bbfed70dae8c7d4619d4e0d339ce738b43/language/parser/parser.go#L105-L114 |
160,767 | graphql-go/graphql | language/parser/parser.go | advance | func advance(parser *Parser) error {
parser.PrevEnd = parser.Token.End
token, err := parser.LexToken(parser.PrevEnd)
if err != nil {
return err
}
parser.Token = token
return nil
} | go | func advance(parser *Parser) error {
parser.PrevEnd = parser.Token.End
token, err := parser.LexToken(parser.PrevEnd)
if err != nil {
return err
}
parser.Token = token
return nil
} | [
"func",
"advance",
"(",
"parser",
"*",
"Parser",
")",
"error",
"{",
"parser",
".",
"PrevEnd",
"=",
"parser",
".",
"Token",
".",
"End",
"\n",
"token",
",",
"err",
":=",
"parser",
".",
"LexToken",
"(",
"parser",
".",
"PrevEnd",
")",
"\n",
"if",
"err",
... | // Moves the internal parser object to the next lexed token. | [
"Moves",
"the",
"internal",
"parser",
"object",
"to",
"the",
"next",
"lexed",
"token",
"."
] | 199d20bbfed70dae8c7d4619d4e0d339ce738b43 | https://github.com/graphql-go/graphql/blob/199d20bbfed70dae8c7d4619d4e0d339ce738b43/language/parser/parser.go#L1497-L1505 |
160,768 | graphql-go/graphql | language/parser/parser.go | lookahead | func lookahead(parser *Parser) (lexer.Token, error) {
return parser.LexToken(parser.Token.End)
} | go | func lookahead(parser *Parser) (lexer.Token, error) {
return parser.LexToken(parser.Token.End)
} | [
"func",
"lookahead",
"(",
"parser",
"*",
"Parser",
")",
"(",
"lexer",
".",
"Token",
",",
"error",
")",
"{",
"return",
"parser",
".",
"LexToken",
"(",
"parser",
".",
"Token",
".",
"End",
")",
"\n",
"}"
] | // lookahead retrieves the next token | [
"lookahead",
"retrieves",
"the",
"next",
"token"
] | 199d20bbfed70dae8c7d4619d4e0d339ce738b43 | https://github.com/graphql-go/graphql/blob/199d20bbfed70dae8c7d4619d4e0d339ce738b43/language/parser/parser.go#L1508-L1510 |
160,769 | graphql-go/graphql | language/parser/parser.go | peek | func peek(parser *Parser, Kind lexer.TokenKind) bool {
return parser.Token.Kind == Kind
} | go | func peek(parser *Parser, Kind lexer.TokenKind) bool {
return parser.Token.Kind == Kind
} | [
"func",
"peek",
"(",
"parser",
"*",
"Parser",
",",
"Kind",
"lexer",
".",
"TokenKind",
")",
"bool",
"{",
"return",
"parser",
".",
"Token",
".",
"Kind",
"==",
"Kind",
"\n",
"}"
] | // Determines if the next token is of a given kind | [
"Determines",
"if",
"the",
"next",
"token",
"is",
"of",
"a",
"given",
"kind"
] | 199d20bbfed70dae8c7d4619d4e0d339ce738b43 | https://github.com/graphql-go/graphql/blob/199d20bbfed70dae8c7d4619d4e0d339ce738b43/language/parser/parser.go#L1513-L1515 |
160,770 | graphql-go/graphql | language/parser/parser.go | peekDescription | func peekDescription(parser *Parser) bool {
return peek(parser, lexer.STRING) || peek(parser, lexer.BLOCK_STRING)
} | go | func peekDescription(parser *Parser) bool {
return peek(parser, lexer.STRING) || peek(parser, lexer.BLOCK_STRING)
} | [
"func",
"peekDescription",
"(",
"parser",
"*",
"Parser",
")",
"bool",
"{",
"return",
"peek",
"(",
"parser",
",",
"lexer",
".",
"STRING",
")",
"||",
"peek",
"(",
"parser",
",",
"lexer",
".",
"BLOCK_STRING",
")",
"\n",
"}"
] | // peekDescription determines if the next token is a string value | [
"peekDescription",
"determines",
"if",
"the",
"next",
"token",
"is",
"a",
"string",
"value"
] | 199d20bbfed70dae8c7d4619d4e0d339ce738b43 | https://github.com/graphql-go/graphql/blob/199d20bbfed70dae8c7d4619d4e0d339ce738b43/language/parser/parser.go#L1518-L1520 |
160,771 | graphql-go/graphql | language/parser/parser.go | skip | func skip(parser *Parser, Kind lexer.TokenKind) (bool, error) {
if parser.Token.Kind == Kind {
return true, advance(parser)
}
return false, nil
} | go | func skip(parser *Parser, Kind lexer.TokenKind) (bool, error) {
if parser.Token.Kind == Kind {
return true, advance(parser)
}
return false, nil
} | [
"func",
"skip",
"(",
"parser",
"*",
"Parser",
",",
"Kind",
"lexer",
".",
"TokenKind",
")",
"(",
"bool",
",",
"error",
")",
"{",
"if",
"parser",
".",
"Token",
".",
"Kind",
"==",
"Kind",
"{",
"return",
"true",
",",
"advance",
"(",
"parser",
")",
"\n"... | // If the next token is of the given kind, return true after advancing
// the parser. Otherwise, do not change the parser state and return false. | [
"If",
"the",
"next",
"token",
"is",
"of",
"the",
"given",
"kind",
"return",
"true",
"after",
"advancing",
"the",
"parser",
".",
"Otherwise",
"do",
"not",
"change",
"the",
"parser",
"state",
"and",
"return",
"false",
"."
] | 199d20bbfed70dae8c7d4619d4e0d339ce738b43 | https://github.com/graphql-go/graphql/blob/199d20bbfed70dae8c7d4619d4e0d339ce738b43/language/parser/parser.go#L1524-L1529 |
160,772 | graphql-go/graphql | language/parser/parser.go | expect | func expect(parser *Parser, kind lexer.TokenKind) (lexer.Token, error) {
token := parser.Token
if token.Kind == kind {
return token, advance(parser)
}
descp := fmt.Sprintf("Expected %s, found %s", kind, lexer.GetTokenDesc(token))
return token, gqlerrors.NewSyntaxError(parser.Source, token.Start, descp)
} | go | func expect(parser *Parser, kind lexer.TokenKind) (lexer.Token, error) {
token := parser.Token
if token.Kind == kind {
return token, advance(parser)
}
descp := fmt.Sprintf("Expected %s, found %s", kind, lexer.GetTokenDesc(token))
return token, gqlerrors.NewSyntaxError(parser.Source, token.Start, descp)
} | [
"func",
"expect",
"(",
"parser",
"*",
"Parser",
",",
"kind",
"lexer",
".",
"TokenKind",
")",
"(",
"lexer",
".",
"Token",
",",
"error",
")",
"{",
"token",
":=",
"parser",
".",
"Token",
"\n",
"if",
"token",
".",
"Kind",
"==",
"kind",
"{",
"return",
"... | // If the next token is of the given kind, return that token after advancing
// the parser. Otherwise, do not change the parser state and return error. | [
"If",
"the",
"next",
"token",
"is",
"of",
"the",
"given",
"kind",
"return",
"that",
"token",
"after",
"advancing",
"the",
"parser",
".",
"Otherwise",
"do",
"not",
"change",
"the",
"parser",
"state",
"and",
"return",
"error",
"."
] | 199d20bbfed70dae8c7d4619d4e0d339ce738b43 | https://github.com/graphql-go/graphql/blob/199d20bbfed70dae8c7d4619d4e0d339ce738b43/language/parser/parser.go#L1533-L1540 |
160,773 | graphql-go/graphql | language/parser/parser.go | expectKeyWord | func expectKeyWord(parser *Parser, value string) (lexer.Token, error) {
token := parser.Token
if token.Kind == lexer.NAME && token.Value == value {
return token, advance(parser)
}
descp := fmt.Sprintf("Expected \"%s\", found %s", value, lexer.GetTokenDesc(token))
return token, gqlerrors.NewSyntaxError(parser.Sou... | go | func expectKeyWord(parser *Parser, value string) (lexer.Token, error) {
token := parser.Token
if token.Kind == lexer.NAME && token.Value == value {
return token, advance(parser)
}
descp := fmt.Sprintf("Expected \"%s\", found %s", value, lexer.GetTokenDesc(token))
return token, gqlerrors.NewSyntaxError(parser.Sou... | [
"func",
"expectKeyWord",
"(",
"parser",
"*",
"Parser",
",",
"value",
"string",
")",
"(",
"lexer",
".",
"Token",
",",
"error",
")",
"{",
"token",
":=",
"parser",
".",
"Token",
"\n",
"if",
"token",
".",
"Kind",
"==",
"lexer",
".",
"NAME",
"&&",
"token"... | // If the next token is a keyword with the given value, return that token after
// advancing the parser. Otherwise, do not change the parser state and return false. | [
"If",
"the",
"next",
"token",
"is",
"a",
"keyword",
"with",
"the",
"given",
"value",
"return",
"that",
"token",
"after",
"advancing",
"the",
"parser",
".",
"Otherwise",
"do",
"not",
"change",
"the",
"parser",
"state",
"and",
"return",
"false",
"."
] | 199d20bbfed70dae8c7d4619d4e0d339ce738b43 | https://github.com/graphql-go/graphql/blob/199d20bbfed70dae8c7d4619d4e0d339ce738b43/language/parser/parser.go#L1544-L1551 |
160,774 | graphql-go/graphql | language/parser/parser.go | unexpected | func unexpected(parser *Parser, atToken lexer.Token) error {
var token = atToken
if (atToken == lexer.Token{}) {
token = parser.Token
}
description := fmt.Sprintf("Unexpected %v", lexer.GetTokenDesc(token))
return gqlerrors.NewSyntaxError(parser.Source, token.Start, description)
} | go | func unexpected(parser *Parser, atToken lexer.Token) error {
var token = atToken
if (atToken == lexer.Token{}) {
token = parser.Token
}
description := fmt.Sprintf("Unexpected %v", lexer.GetTokenDesc(token))
return gqlerrors.NewSyntaxError(parser.Source, token.Start, description)
} | [
"func",
"unexpected",
"(",
"parser",
"*",
"Parser",
",",
"atToken",
"lexer",
".",
"Token",
")",
"error",
"{",
"var",
"token",
"=",
"atToken",
"\n",
"if",
"(",
"atToken",
"==",
"lexer",
".",
"Token",
"{",
"}",
")",
"{",
"token",
"=",
"parser",
".",
... | // Helper function for creating an error when an unexpected lexed token
// is encountered. | [
"Helper",
"function",
"for",
"creating",
"an",
"error",
"when",
"an",
"unexpected",
"lexed",
"token",
"is",
"encountered",
"."
] | 199d20bbfed70dae8c7d4619d4e0d339ce738b43 | https://github.com/graphql-go/graphql/blob/199d20bbfed70dae8c7d4619d4e0d339ce738b43/language/parser/parser.go#L1555-L1562 |
160,775 | graphql-go/graphql | rules.go | ArgumentsOfCorrectTypeRule | func ArgumentsOfCorrectTypeRule(context *ValidationContext) *ValidationRuleInstance {
visitorOpts := &visitor.VisitorOptions{
KindFuncMap: map[string]visitor.NamedVisitFuncs{
kinds.Argument: {
Kind: func(p visitor.VisitFuncParams) (string, interface{}) {
if argAST, ok := p.Node.(*ast.Argument); ok {
... | go | func ArgumentsOfCorrectTypeRule(context *ValidationContext) *ValidationRuleInstance {
visitorOpts := &visitor.VisitorOptions{
KindFuncMap: map[string]visitor.NamedVisitFuncs{
kinds.Argument: {
Kind: func(p visitor.VisitFuncParams) (string, interface{}) {
if argAST, ok := p.Node.(*ast.Argument); ok {
... | [
"func",
"ArgumentsOfCorrectTypeRule",
"(",
"context",
"*",
"ValidationContext",
")",
"*",
"ValidationRuleInstance",
"{",
"visitorOpts",
":=",
"&",
"visitor",
".",
"VisitorOptions",
"{",
"KindFuncMap",
":",
"map",
"[",
"string",
"]",
"visitor",
".",
"NamedVisitFuncs"... | // ArgumentsOfCorrectTypeRule Argument values of correct type
//
// A GraphQL document is only valid if all field argument literal values are
// of the type expected by their position. | [
"ArgumentsOfCorrectTypeRule",
"Argument",
"values",
"of",
"correct",
"type",
"A",
"GraphQL",
"document",
"is",
"only",
"valid",
"if",
"all",
"field",
"argument",
"literal",
"values",
"are",
"of",
"the",
"type",
"expected",
"by",
"their",
"position",
"."
] | 199d20bbfed70dae8c7d4619d4e0d339ce738b43 | https://github.com/graphql-go/graphql/blob/199d20bbfed70dae8c7d4619d4e0d339ce738b43/rules.go#L70-L104 |
160,776 | graphql-go/graphql | rules.go | DefaultValuesOfCorrectTypeRule | func DefaultValuesOfCorrectTypeRule(context *ValidationContext) *ValidationRuleInstance {
visitorOpts := &visitor.VisitorOptions{
KindFuncMap: map[string]visitor.NamedVisitFuncs{
kinds.VariableDefinition: {
Kind: func(p visitor.VisitFuncParams) (string, interface{}) {
if varDefAST, ok := p.Node.(*ast.Var... | go | func DefaultValuesOfCorrectTypeRule(context *ValidationContext) *ValidationRuleInstance {
visitorOpts := &visitor.VisitorOptions{
KindFuncMap: map[string]visitor.NamedVisitFuncs{
kinds.VariableDefinition: {
Kind: func(p visitor.VisitFuncParams) (string, interface{}) {
if varDefAST, ok := p.Node.(*ast.Var... | [
"func",
"DefaultValuesOfCorrectTypeRule",
"(",
"context",
"*",
"ValidationContext",
")",
"*",
"ValidationRuleInstance",
"{",
"visitorOpts",
":=",
"&",
"visitor",
".",
"VisitorOptions",
"{",
"KindFuncMap",
":",
"map",
"[",
"string",
"]",
"visitor",
".",
"NamedVisitFu... | // DefaultValuesOfCorrectTypeRule Variable default values of correct type
//
// A GraphQL document is only valid if all variable default values are of the
// type expected by their definition. | [
"DefaultValuesOfCorrectTypeRule",
"Variable",
"default",
"values",
"of",
"correct",
"type",
"A",
"GraphQL",
"document",
"is",
"only",
"valid",
"if",
"all",
"variable",
"default",
"values",
"are",
"of",
"the",
"type",
"expected",
"by",
"their",
"definition",
"."
] | 199d20bbfed70dae8c7d4619d4e0d339ce738b43 | https://github.com/graphql-go/graphql/blob/199d20bbfed70dae8c7d4619d4e0d339ce738b43/rules.go#L110-L165 |
160,777 | graphql-go/graphql | rules.go | getSuggestedTypeNames | func getSuggestedTypeNames(schema *Schema, ttype Output, fieldName string) []string {
var (
suggestedObjectTypes = []string{}
suggestedInterfaces = []*suggestedInterface{}
// stores a map of interface name => index in suggestedInterfaces
suggestedInterfaceMap = map[string]int{}
// stores a maps of object na... | go | func getSuggestedTypeNames(schema *Schema, ttype Output, fieldName string) []string {
var (
suggestedObjectTypes = []string{}
suggestedInterfaces = []*suggestedInterface{}
// stores a map of interface name => index in suggestedInterfaces
suggestedInterfaceMap = map[string]int{}
// stores a maps of object na... | [
"func",
"getSuggestedTypeNames",
"(",
"schema",
"*",
"Schema",
",",
"ttype",
"Output",
",",
"fieldName",
"string",
")",
"[",
"]",
"string",
"{",
"var",
"(",
"suggestedObjectTypes",
"=",
"[",
"]",
"string",
"{",
"}",
"\n",
"suggestedInterfaces",
"=",
"[",
"... | // getSuggestedTypeNames Go through all of the implementations of type, as well as the interfaces
// that they implement. If any of those types include the provided field,
// suggest them, sorted by how often the type is referenced, starting
// with Interfaces. | [
"getSuggestedTypeNames",
"Go",
"through",
"all",
"of",
"the",
"implementations",
"of",
"type",
"as",
"well",
"as",
"the",
"interfaces",
"that",
"they",
"implement",
".",
"If",
"any",
"of",
"those",
"types",
"include",
"the",
"provided",
"field",
"suggest",
"th... | 199d20bbfed70dae8c7d4619d4e0d339ce738b43 | https://github.com/graphql-go/graphql/blob/199d20bbfed70dae8c7d4619d4e0d339ce738b43/rules.go#L260-L322 |
160,778 | graphql-go/graphql | rules.go | getSuggestedFieldNames | func getSuggestedFieldNames(schema *Schema, ttype Output, fieldName string) []string {
fields := FieldDefinitionMap{}
switch ttype := ttype.(type) {
case *Object:
fields = ttype.Fields()
case *Interface:
fields = ttype.Fields()
default:
return []string{}
}
possibleFieldNames := []string{}
for possibleFi... | go | func getSuggestedFieldNames(schema *Schema, ttype Output, fieldName string) []string {
fields := FieldDefinitionMap{}
switch ttype := ttype.(type) {
case *Object:
fields = ttype.Fields()
case *Interface:
fields = ttype.Fields()
default:
return []string{}
}
possibleFieldNames := []string{}
for possibleFi... | [
"func",
"getSuggestedFieldNames",
"(",
"schema",
"*",
"Schema",
",",
"ttype",
"Output",
",",
"fieldName",
"string",
")",
"[",
"]",
"string",
"{",
"fields",
":=",
"FieldDefinitionMap",
"{",
"}",
"\n",
"switch",
"ttype",
":=",
"ttype",
".",
"(",
"type",
")",... | // getSuggestedFieldNames For the field name provided, determine if there are any similar field names
// that may be the result of a typo. | [
"getSuggestedFieldNames",
"For",
"the",
"field",
"name",
"provided",
"determine",
"if",
"there",
"are",
"any",
"similar",
"field",
"names",
"that",
"may",
"be",
"the",
"result",
"of",
"a",
"typo",
"."
] | 199d20bbfed70dae8c7d4619d4e0d339ce738b43 | https://github.com/graphql-go/graphql/blob/199d20bbfed70dae8c7d4619d4e0d339ce738b43/rules.go#L326-L343 |
160,779 | graphql-go/graphql | rules.go | KnownArgumentNamesRule | func KnownArgumentNamesRule(context *ValidationContext) *ValidationRuleInstance {
visitorOpts := &visitor.VisitorOptions{
KindFuncMap: map[string]visitor.NamedVisitFuncs{
kinds.Argument: {
Kind: func(p visitor.VisitFuncParams) (string, interface{}) {
var action = visitor.ActionNoChange
if node, ok :... | go | func KnownArgumentNamesRule(context *ValidationContext) *ValidationRuleInstance {
visitorOpts := &visitor.VisitorOptions{
KindFuncMap: map[string]visitor.NamedVisitFuncs{
kinds.Argument: {
Kind: func(p visitor.VisitFuncParams) (string, interface{}) {
var action = visitor.ActionNoChange
if node, ok :... | [
"func",
"KnownArgumentNamesRule",
"(",
"context",
"*",
"ValidationContext",
")",
"*",
"ValidationRuleInstance",
"{",
"visitorOpts",
":=",
"&",
"visitor",
".",
"VisitorOptions",
"{",
"KindFuncMap",
":",
"map",
"[",
"string",
"]",
"visitor",
".",
"NamedVisitFuncs",
... | // KnownArgumentNamesRule Known argument names
//
// A GraphQL field is only valid if all supplied arguments are defined by
// that field. | [
"KnownArgumentNamesRule",
"Known",
"argument",
"names",
"A",
"GraphQL",
"field",
"is",
"only",
"valid",
"if",
"all",
"supplied",
"arguments",
"are",
"defined",
"by",
"that",
"field",
"."
] | 199d20bbfed70dae8c7d4619d4e0d339ce738b43 | https://github.com/graphql-go/graphql/blob/199d20bbfed70dae8c7d4619d4e0d339ce738b43/rules.go#L438-L520 |
160,780 | graphql-go/graphql | rules.go | KnownDirectivesRule | func KnownDirectivesRule(context *ValidationContext) *ValidationRuleInstance {
visitorOpts := &visitor.VisitorOptions{
KindFuncMap: map[string]visitor.NamedVisitFuncs{
kinds.Directive: {
Kind: func(p visitor.VisitFuncParams) (string, interface{}) {
var action = visitor.ActionNoChange
var result inte... | go | func KnownDirectivesRule(context *ValidationContext) *ValidationRuleInstance {
visitorOpts := &visitor.VisitorOptions{
KindFuncMap: map[string]visitor.NamedVisitFuncs{
kinds.Directive: {
Kind: func(p visitor.VisitFuncParams) (string, interface{}) {
var action = visitor.ActionNoChange
var result inte... | [
"func",
"KnownDirectivesRule",
"(",
"context",
"*",
"ValidationContext",
")",
"*",
"ValidationRuleInstance",
"{",
"visitorOpts",
":=",
"&",
"visitor",
".",
"VisitorOptions",
"{",
"KindFuncMap",
":",
"map",
"[",
"string",
"]",
"visitor",
".",
"NamedVisitFuncs",
"{"... | // KnownDirectivesRule Known directives
//
// A GraphQL document is only valid if all `@directives` are known by the
// schema and legally positioned. | [
"KnownDirectivesRule",
"Known",
"directives",
"A",
"GraphQL",
"document",
"is",
"only",
"valid",
"if",
"all"
] | 199d20bbfed70dae8c7d4619d4e0d339ce738b43 | https://github.com/graphql-go/graphql/blob/199d20bbfed70dae8c7d4619d4e0d339ce738b43/rules.go#L530-L591 |
160,781 | graphql-go/graphql | rules.go | KnownFragmentNamesRule | func KnownFragmentNamesRule(context *ValidationContext) *ValidationRuleInstance {
visitorOpts := &visitor.VisitorOptions{
KindFuncMap: map[string]visitor.NamedVisitFuncs{
kinds.FragmentSpread: {
Kind: func(p visitor.VisitFuncParams) (string, interface{}) {
var action = visitor.ActionNoChange
var res... | go | func KnownFragmentNamesRule(context *ValidationContext) *ValidationRuleInstance {
visitorOpts := &visitor.VisitorOptions{
KindFuncMap: map[string]visitor.NamedVisitFuncs{
kinds.FragmentSpread: {
Kind: func(p visitor.VisitFuncParams) (string, interface{}) {
var action = visitor.ActionNoChange
var res... | [
"func",
"KnownFragmentNamesRule",
"(",
"context",
"*",
"ValidationContext",
")",
"*",
"ValidationRuleInstance",
"{",
"visitorOpts",
":=",
"&",
"visitor",
".",
"VisitorOptions",
"{",
"KindFuncMap",
":",
"map",
"[",
"string",
"]",
"visitor",
".",
"NamedVisitFuncs",
... | // KnownFragmentNamesRule Known fragment names
//
// A GraphQL document is only valid if all `...Fragment` fragment spreads refer
// to fragments defined in the same document. | [
"KnownFragmentNamesRule",
"Known",
"fragment",
"names",
"A",
"GraphQL",
"document",
"is",
"only",
"valid",
"if",
"all",
"...",
"Fragment",
"fragment",
"spreads",
"refer",
"to",
"fragments",
"defined",
"in",
"the",
"same",
"document",
"."
] | 199d20bbfed70dae8c7d4619d4e0d339ce738b43 | https://github.com/graphql-go/graphql/blob/199d20bbfed70dae8c7d4619d4e0d339ce738b43/rules.go#L671-L702 |
160,782 | graphql-go/graphql | rules.go | NoUndefinedVariablesRule | func NoUndefinedVariablesRule(context *ValidationContext) *ValidationRuleInstance {
var variableNameDefined = map[string]bool{}
visitorOpts := &visitor.VisitorOptions{
KindFuncMap: map[string]visitor.NamedVisitFuncs{
kinds.OperationDefinition: {
Enter: func(p visitor.VisitFuncParams) (string, interface{}) {... | go | func NoUndefinedVariablesRule(context *ValidationContext) *ValidationRuleInstance {
var variableNameDefined = map[string]bool{}
visitorOpts := &visitor.VisitorOptions{
KindFuncMap: map[string]visitor.NamedVisitFuncs{
kinds.OperationDefinition: {
Enter: func(p visitor.VisitFuncParams) (string, interface{}) {... | [
"func",
"NoUndefinedVariablesRule",
"(",
"context",
"*",
"ValidationContext",
")",
"*",
"ValidationRuleInstance",
"{",
"var",
"variableNameDefined",
"=",
"map",
"[",
"string",
"]",
"bool",
"{",
"}",
"\n\n",
"visitorOpts",
":=",
"&",
"visitor",
".",
"VisitorOptions... | // NoUndefinedVariablesRule No undefined variables
//
// A GraphQL operation is only valid if all variables encountered, both directly
// and via fragment spreads, are defined by that operation. | [
"NoUndefinedVariablesRule",
"No",
"undefined",
"variables",
"A",
"GraphQL",
"operation",
"is",
"only",
"valid",
"if",
"all",
"variables",
"encountered",
"both",
"directly",
"and",
"via",
"fragment",
"spreads",
"are",
"defined",
"by",
"that",
"operation",
"."
] | 199d20bbfed70dae8c7d4619d4e0d339ce738b43 | https://github.com/graphql-go/graphql/blob/199d20bbfed70dae8c7d4619d4e0d339ce738b43/rules.go#L938-L996 |
160,783 | graphql-go/graphql | rules.go | NoUnusedFragmentsRule | func NoUnusedFragmentsRule(context *ValidationContext) *ValidationRuleInstance {
var fragmentDefs = []*ast.FragmentDefinition{}
var operationDefs = []*ast.OperationDefinition{}
visitorOpts := &visitor.VisitorOptions{
KindFuncMap: map[string]visitor.NamedVisitFuncs{
kinds.OperationDefinition: {
Kind: func(... | go | func NoUnusedFragmentsRule(context *ValidationContext) *ValidationRuleInstance {
var fragmentDefs = []*ast.FragmentDefinition{}
var operationDefs = []*ast.OperationDefinition{}
visitorOpts := &visitor.VisitorOptions{
KindFuncMap: map[string]visitor.NamedVisitFuncs{
kinds.OperationDefinition: {
Kind: func(... | [
"func",
"NoUnusedFragmentsRule",
"(",
"context",
"*",
"ValidationContext",
")",
"*",
"ValidationRuleInstance",
"{",
"var",
"fragmentDefs",
"=",
"[",
"]",
"*",
"ast",
".",
"FragmentDefinition",
"{",
"}",
"\n",
"var",
"operationDefs",
"=",
"[",
"]",
"*",
"ast",
... | // NoUnusedFragmentsRule No unused fragments
//
// A GraphQL document is only valid if all fragment definitions are spread
// within operations, or spread within other fragments spread within operations. | [
"NoUnusedFragmentsRule",
"No",
"unused",
"fragments",
"A",
"GraphQL",
"document",
"is",
"only",
"valid",
"if",
"all",
"fragment",
"definitions",
"are",
"spread",
"within",
"operations",
"or",
"spread",
"within",
"other",
"fragments",
"spread",
"within",
"operations"... | 199d20bbfed70dae8c7d4619d4e0d339ce738b43 | https://github.com/graphql-go/graphql/blob/199d20bbfed70dae8c7d4619d4e0d339ce738b43/rules.go#L1002-L1062 |
160,784 | graphql-go/graphql | rules.go | NoUnusedVariablesRule | func NoUnusedVariablesRule(context *ValidationContext) *ValidationRuleInstance {
var variableDefs = []*ast.VariableDefinition{}
visitorOpts := &visitor.VisitorOptions{
KindFuncMap: map[string]visitor.NamedVisitFuncs{
kinds.OperationDefinition: {
Enter: func(p visitor.VisitFuncParams) (string, interface{}) ... | go | func NoUnusedVariablesRule(context *ValidationContext) *ValidationRuleInstance {
var variableDefs = []*ast.VariableDefinition{}
visitorOpts := &visitor.VisitorOptions{
KindFuncMap: map[string]visitor.NamedVisitFuncs{
kinds.OperationDefinition: {
Enter: func(p visitor.VisitFuncParams) (string, interface{}) ... | [
"func",
"NoUnusedVariablesRule",
"(",
"context",
"*",
"ValidationContext",
")",
"*",
"ValidationRuleInstance",
"{",
"var",
"variableDefs",
"=",
"[",
"]",
"*",
"ast",
".",
"VariableDefinition",
"{",
"}",
"\n\n",
"visitorOpts",
":=",
"&",
"visitor",
".",
"VisitorO... | // NoUnusedVariablesRule No unused variables
//
// A GraphQL operation is only valid if all variables defined by an operation
// are used, either directly or within a spread fragment. | [
"NoUnusedVariablesRule",
"No",
"unused",
"variables",
"A",
"GraphQL",
"operation",
"is",
"only",
"valid",
"if",
"all",
"variables",
"defined",
"by",
"an",
"operation",
"are",
"used",
"either",
"directly",
"or",
"within",
"a",
"spread",
"fragment",
"."
] | 199d20bbfed70dae8c7d4619d4e0d339ce738b43 | https://github.com/graphql-go/graphql/blob/199d20bbfed70dae8c7d4619d4e0d339ce738b43/rules.go#L1075-L1136 |
160,785 | graphql-go/graphql | rules.go | UniqueArgumentNamesRule | func UniqueArgumentNamesRule(context *ValidationContext) *ValidationRuleInstance {
knownArgNames := map[string]*ast.Name{}
visitorOpts := &visitor.VisitorOptions{
KindFuncMap: map[string]visitor.NamedVisitFuncs{
kinds.Field: {
Kind: func(p visitor.VisitFuncParams) (string, interface{}) {
knownArgNames ... | go | func UniqueArgumentNamesRule(context *ValidationContext) *ValidationRuleInstance {
knownArgNames := map[string]*ast.Name{}
visitorOpts := &visitor.VisitorOptions{
KindFuncMap: map[string]visitor.NamedVisitFuncs{
kinds.Field: {
Kind: func(p visitor.VisitFuncParams) (string, interface{}) {
knownArgNames ... | [
"func",
"UniqueArgumentNamesRule",
"(",
"context",
"*",
"ValidationContext",
")",
"*",
"ValidationRuleInstance",
"{",
"knownArgNames",
":=",
"map",
"[",
"string",
"]",
"*",
"ast",
".",
"Name",
"{",
"}",
"\n\n",
"visitorOpts",
":=",
"&",
"visitor",
".",
"Visito... | // UniqueArgumentNamesRule Unique argument names
//
// A GraphQL field or directive is only valid if all supplied arguments are
// uniquely named. | [
"UniqueArgumentNamesRule",
"Unique",
"argument",
"names",
"A",
"GraphQL",
"field",
"or",
"directive",
"is",
"only",
"valid",
"if",
"all",
"supplied",
"arguments",
"are",
"uniquely",
"named",
"."
] | 199d20bbfed70dae8c7d4619d4e0d339ce738b43 | https://github.com/graphql-go/graphql/blob/199d20bbfed70dae8c7d4619d4e0d339ce738b43/rules.go#L1388-L1430 |
160,786 | graphql-go/graphql | rules.go | UniqueFragmentNamesRule | func UniqueFragmentNamesRule(context *ValidationContext) *ValidationRuleInstance {
knownFragmentNames := map[string]*ast.Name{}
visitorOpts := &visitor.VisitorOptions{
KindFuncMap: map[string]visitor.NamedVisitFuncs{
kinds.OperationDefinition: {
Kind: func(p visitor.VisitFuncParams) (string, interface{}) {
... | go | func UniqueFragmentNamesRule(context *ValidationContext) *ValidationRuleInstance {
knownFragmentNames := map[string]*ast.Name{}
visitorOpts := &visitor.VisitorOptions{
KindFuncMap: map[string]visitor.NamedVisitFuncs{
kinds.OperationDefinition: {
Kind: func(p visitor.VisitFuncParams) (string, interface{}) {
... | [
"func",
"UniqueFragmentNamesRule",
"(",
"context",
"*",
"ValidationContext",
")",
"*",
"ValidationRuleInstance",
"{",
"knownFragmentNames",
":=",
"map",
"[",
"string",
"]",
"*",
"ast",
".",
"Name",
"{",
"}",
"\n\n",
"visitorOpts",
":=",
"&",
"visitor",
".",
"V... | // UniqueFragmentNamesRule Unique fragment names
//
// A GraphQL document is only valid if all defined fragments have unique names. | [
"UniqueFragmentNamesRule",
"Unique",
"fragment",
"names",
"A",
"GraphQL",
"document",
"is",
"only",
"valid",
"if",
"all",
"defined",
"fragments",
"have",
"unique",
"names",
"."
] | 199d20bbfed70dae8c7d4619d4e0d339ce738b43 | https://github.com/graphql-go/graphql/blob/199d20bbfed70dae8c7d4619d4e0d339ce738b43/rules.go#L1435-L1470 |
160,787 | graphql-go/graphql | rules.go | UniqueInputFieldNamesRule | func UniqueInputFieldNamesRule(context *ValidationContext) *ValidationRuleInstance {
knownNameStack := []map[string]*ast.Name{}
knownNames := map[string]*ast.Name{}
visitorOpts := &visitor.VisitorOptions{
KindFuncMap: map[string]visitor.NamedVisitFuncs{
kinds.ObjectValue: {
Enter: func(p visitor.VisitFuncP... | go | func UniqueInputFieldNamesRule(context *ValidationContext) *ValidationRuleInstance {
knownNameStack := []map[string]*ast.Name{}
knownNames := map[string]*ast.Name{}
visitorOpts := &visitor.VisitorOptions{
KindFuncMap: map[string]visitor.NamedVisitFuncs{
kinds.ObjectValue: {
Enter: func(p visitor.VisitFuncP... | [
"func",
"UniqueInputFieldNamesRule",
"(",
"context",
"*",
"ValidationContext",
")",
"*",
"ValidationRuleInstance",
"{",
"knownNameStack",
":=",
"[",
"]",
"map",
"[",
"string",
"]",
"*",
"ast",
".",
"Name",
"{",
"}",
"\n",
"knownNames",
":=",
"map",
"[",
"str... | // UniqueInputFieldNamesRule Unique input field names
//
// A GraphQL input object value is only valid if all supplied fields are
// uniquely named. | [
"UniqueInputFieldNamesRule",
"Unique",
"input",
"field",
"names",
"A",
"GraphQL",
"input",
"object",
"value",
"is",
"only",
"valid",
"if",
"all",
"supplied",
"fields",
"are",
"uniquely",
"named",
"."
] | 199d20bbfed70dae8c7d4619d4e0d339ce738b43 | https://github.com/graphql-go/graphql/blob/199d20bbfed70dae8c7d4619d4e0d339ce738b43/rules.go#L1476-L1520 |
160,788 | graphql-go/graphql | rules.go | UniqueOperationNamesRule | func UniqueOperationNamesRule(context *ValidationContext) *ValidationRuleInstance {
knownOperationNames := make(map[string]ast.Node)
visitorOpts := &visitor.VisitorOptions{
KindFuncMap: map[string]visitor.NamedVisitFuncs{
kinds.OperationDefinition: {
Kind: func(p visitor.VisitFuncParams) (string, interface{... | go | func UniqueOperationNamesRule(context *ValidationContext) *ValidationRuleInstance {
knownOperationNames := make(map[string]ast.Node)
visitorOpts := &visitor.VisitorOptions{
KindFuncMap: map[string]visitor.NamedVisitFuncs{
kinds.OperationDefinition: {
Kind: func(p visitor.VisitFuncParams) (string, interface{... | [
"func",
"UniqueOperationNamesRule",
"(",
"context",
"*",
"ValidationContext",
")",
"*",
"ValidationRuleInstance",
"{",
"knownOperationNames",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"ast",
".",
"Node",
")",
"\n\n",
"visitorOpts",
":=",
"&",
"visitor",
".",... | // UniqueOperationNamesRule Unique operation names
//
// A GraphQL document is only valid if all defined operations have unique names. | [
"UniqueOperationNamesRule",
"Unique",
"operation",
"names",
"A",
"GraphQL",
"document",
"is",
"only",
"valid",
"if",
"all",
"defined",
"operations",
"have",
"unique",
"names",
"."
] | 199d20bbfed70dae8c7d4619d4e0d339ce738b43 | https://github.com/graphql-go/graphql/blob/199d20bbfed70dae8c7d4619d4e0d339ce738b43/rules.go#L1525-L1564 |
160,789 | graphql-go/graphql | rules.go | UniqueVariableNamesRule | func UniqueVariableNamesRule(context *ValidationContext) *ValidationRuleInstance {
knownVariableNames := map[string]*ast.Name{}
visitorOpts := &visitor.VisitorOptions{
KindFuncMap: map[string]visitor.NamedVisitFuncs{
kinds.OperationDefinition: {
Kind: func(p visitor.VisitFuncParams) (string, interface{}) {
... | go | func UniqueVariableNamesRule(context *ValidationContext) *ValidationRuleInstance {
knownVariableNames := map[string]*ast.Name{}
visitorOpts := &visitor.VisitorOptions{
KindFuncMap: map[string]visitor.NamedVisitFuncs{
kinds.OperationDefinition: {
Kind: func(p visitor.VisitFuncParams) (string, interface{}) {
... | [
"func",
"UniqueVariableNamesRule",
"(",
"context",
"*",
"ValidationContext",
")",
"*",
"ValidationRuleInstance",
"{",
"knownVariableNames",
":=",
"map",
"[",
"string",
"]",
"*",
"ast",
".",
"Name",
"{",
"}",
"\n\n",
"visitorOpts",
":=",
"&",
"visitor",
".",
"V... | // UniqueVariableNamesRule Unique variable names
//
// A GraphQL operation is only valid if all its variables are uniquely named. | [
"UniqueVariableNamesRule",
"Unique",
"variable",
"names",
"A",
"GraphQL",
"operation",
"is",
"only",
"valid",
"if",
"all",
"its",
"variables",
"are",
"uniquely",
"named",
"."
] | 199d20bbfed70dae8c7d4619d4e0d339ce738b43 | https://github.com/graphql-go/graphql/blob/199d20bbfed70dae8c7d4619d4e0d339ce738b43/rules.go#L1569-L1609 |
160,790 | graphql-go/graphql | rules.go | effectiveType | func effectiveType(varType Type, varDef *ast.VariableDefinition) Type {
if varDef.DefaultValue == nil {
return varType
}
if _, ok := varType.(*NonNull); ok {
return varType
}
return NewNonNull(varType)
} | go | func effectiveType(varType Type, varDef *ast.VariableDefinition) Type {
if varDef.DefaultValue == nil {
return varType
}
if _, ok := varType.(*NonNull); ok {
return varType
}
return NewNonNull(varType)
} | [
"func",
"effectiveType",
"(",
"varType",
"Type",
",",
"varDef",
"*",
"ast",
".",
"VariableDefinition",
")",
"Type",
"{",
"if",
"varDef",
".",
"DefaultValue",
"==",
"nil",
"{",
"return",
"varType",
"\n",
"}",
"\n",
"if",
"_",
",",
"ok",
":=",
"varType",
... | // If a variable definition has a default value, it's effectively non-null. | [
"If",
"a",
"variable",
"definition",
"has",
"a",
"default",
"value",
"it",
"s",
"effectively",
"non",
"-",
"null",
"."
] | 199d20bbfed70dae8c7d4619d4e0d339ce738b43 | https://github.com/graphql-go/graphql/blob/199d20bbfed70dae8c7d4619d4e0d339ce738b43/rules.go#L1649-L1657 |
160,791 | graphql-go/graphql | rules.go | VariablesInAllowedPositionRule | func VariablesInAllowedPositionRule(context *ValidationContext) *ValidationRuleInstance {
varDefMap := map[string]*ast.VariableDefinition{}
visitorOpts := &visitor.VisitorOptions{
KindFuncMap: map[string]visitor.NamedVisitFuncs{
kinds.OperationDefinition: {
Enter: func(p visitor.VisitFuncParams) (string, i... | go | func VariablesInAllowedPositionRule(context *ValidationContext) *ValidationRuleInstance {
varDefMap := map[string]*ast.VariableDefinition{}
visitorOpts := &visitor.VisitorOptions{
KindFuncMap: map[string]visitor.NamedVisitFuncs{
kinds.OperationDefinition: {
Enter: func(p visitor.VisitFuncParams) (string, i... | [
"func",
"VariablesInAllowedPositionRule",
"(",
"context",
"*",
"ValidationContext",
")",
"*",
"ValidationRuleInstance",
"{",
"varDefMap",
":=",
"map",
"[",
"string",
"]",
"*",
"ast",
".",
"VariableDefinition",
"{",
"}",
"\n\n",
"visitorOpts",
":=",
"&",
"visitor",... | // VariablesInAllowedPositionRule Variables passed to field arguments conform to type | [
"VariablesInAllowedPositionRule",
"Variables",
"passed",
"to",
"field",
"arguments",
"conform",
"to",
"type"
] | 199d20bbfed70dae8c7d4619d4e0d339ce738b43 | https://github.com/graphql-go/graphql/blob/199d20bbfed70dae8c7d4619d4e0d339ce738b43/rules.go#L1660-L1720 |
160,792 | graphql-go/graphql | rules.go | suggestionList | func suggestionList(input string, options []string) []string {
dists := []float64{}
filteredOpts := []string{}
inputThreshold := float64(len(input) / 2)
for _, opt := range options {
dist := lexicalDistance(input, opt)
threshold := math.Max(inputThreshold, float64(len(opt)/2))
threshold = math.Max(threshold,... | go | func suggestionList(input string, options []string) []string {
dists := []float64{}
filteredOpts := []string{}
inputThreshold := float64(len(input) / 2)
for _, opt := range options {
dist := lexicalDistance(input, opt)
threshold := math.Max(inputThreshold, float64(len(opt)/2))
threshold = math.Max(threshold,... | [
"func",
"suggestionList",
"(",
"input",
"string",
",",
"options",
"[",
"]",
"string",
")",
"[",
"]",
"string",
"{",
"dists",
":=",
"[",
"]",
"float64",
"{",
"}",
"\n",
"filteredOpts",
":=",
"[",
"]",
"string",
"{",
"}",
"\n",
"inputThreshold",
":=",
... | // suggestionList Given an invalid input string and a list of valid options, returns a filtered
// list of valid options sorted based on their similarity with the input. | [
"suggestionList",
"Given",
"an",
"invalid",
"input",
"string",
"and",
"a",
"list",
"of",
"valid",
"options",
"returns",
"a",
"filtered",
"list",
"of",
"valid",
"options",
"sorted",
"based",
"on",
"their",
"similarity",
"with",
"the",
"input",
"."
] | 199d20bbfed70dae8c7d4619d4e0d339ce738b43 | https://github.com/graphql-go/graphql/blob/199d20bbfed70dae8c7d4619d4e0d339ce738b43/rules.go#L1830-L1848 |
160,793 | graphql-go/graphql | rules.go | lexicalDistance | func lexicalDistance(a, b string) float64 {
d := [][]float64{}
aLen := len(a)
bLen := len(b)
for i := 0; i <= aLen; i++ {
d = append(d, []float64{float64(i)})
}
for k := 1; k <= bLen; k++ {
d[0] = append(d[0], float64(k))
}
for i := 1; i <= aLen; i++ {
for k := 1; k <= bLen; k++ {
cost := 1.0
if a[... | go | func lexicalDistance(a, b string) float64 {
d := [][]float64{}
aLen := len(a)
bLen := len(b)
for i := 0; i <= aLen; i++ {
d = append(d, []float64{float64(i)})
}
for k := 1; k <= bLen; k++ {
d[0] = append(d[0], float64(k))
}
for i := 1; i <= aLen; i++ {
for k := 1; k <= bLen; k++ {
cost := 1.0
if a[... | [
"func",
"lexicalDistance",
"(",
"a",
",",
"b",
"string",
")",
"float64",
"{",
"d",
":=",
"[",
"]",
"[",
"]",
"float64",
"{",
"}",
"\n",
"aLen",
":=",
"len",
"(",
"a",
")",
"\n",
"bLen",
":=",
"len",
"(",
"b",
")",
"\n",
"for",
"i",
":=",
"0",... | // lexicalDistance Computes the lexical distance between strings A and B.
// The "distance" between two strings is given by counting the minimum number
// of edits needed to transform string A into string B. An edit can be an
// insertion, deletion, or substitution of a single character, or a swap of two
// adjacent ch... | [
"lexicalDistance",
"Computes",
"the",
"lexical",
"distance",
"between",
"strings",
"A",
"and",
"B",
".",
"The",
"distance",
"between",
"two",
"strings",
"is",
"given",
"by",
"counting",
"the",
"minimum",
"number",
"of",
"edits",
"needed",
"to",
"transform",
"s... | 199d20bbfed70dae8c7d4619d4e0d339ce738b43 | https://github.com/graphql-go/graphql/blob/199d20bbfed70dae8c7d4619d4e0d339ce738b43/rules.go#L1856-L1892 |
160,794 | graphql-go/graphql | util.go | BindArg | func BindArg(obj interface{}, tags ...string) FieldConfigArgument {
v := reflect.Indirect(reflect.ValueOf(obj))
var config = make(FieldConfigArgument)
for i := 0; i < v.NumField(); i++ {
field := v.Type().Field(i)
mytag := extractTag(field.Tag)
if inArray(tags, mytag) {
config[mytag] = &ArgumentConfig{
... | go | func BindArg(obj interface{}, tags ...string) FieldConfigArgument {
v := reflect.Indirect(reflect.ValueOf(obj))
var config = make(FieldConfigArgument)
for i := 0; i < v.NumField(); i++ {
field := v.Type().Field(i)
mytag := extractTag(field.Tag)
if inArray(tags, mytag) {
config[mytag] = &ArgumentConfig{
... | [
"func",
"BindArg",
"(",
"obj",
"interface",
"{",
"}",
",",
"tags",
"...",
"string",
")",
"FieldConfigArgument",
"{",
"v",
":=",
"reflect",
".",
"Indirect",
"(",
"reflect",
".",
"ValueOf",
"(",
"obj",
")",
")",
"\n",
"var",
"config",
"=",
"make",
"(",
... | // lazy way of binding args | [
"lazy",
"way",
"of",
"binding",
"args"
] | 199d20bbfed70dae8c7d4619d4e0d339ce738b43 | https://github.com/graphql-go/graphql/blob/199d20bbfed70dae8c7d4619d4e0d339ce738b43/util.go#L148-L162 |
160,795 | graphql-go/graphql | language/visitor/visitor.go | updateNodeField | func updateNodeField(src interface{}, targetName string, target interface{}) interface{} {
var isPtr bool
srcVal := reflect.ValueOf(src)
// verify condition
if srcVal.Kind() == reflect.Ptr {
isPtr = true
srcVal = srcVal.Elem()
}
targetVal := reflect.ValueOf(target)
if srcVal.Kind() != reflect.Struct {
retu... | go | func updateNodeField(src interface{}, targetName string, target interface{}) interface{} {
var isPtr bool
srcVal := reflect.ValueOf(src)
// verify condition
if srcVal.Kind() == reflect.Ptr {
isPtr = true
srcVal = srcVal.Elem()
}
targetVal := reflect.ValueOf(target)
if srcVal.Kind() != reflect.Struct {
retu... | [
"func",
"updateNodeField",
"(",
"src",
"interface",
"{",
"}",
",",
"targetName",
"string",
",",
"target",
"interface",
"{",
"}",
")",
"interface",
"{",
"}",
"{",
"var",
"isPtr",
"bool",
"\n",
"srcVal",
":=",
"reflect",
".",
"ValueOf",
"(",
"src",
")",
... | // currently only supports update struct field value | [
"currently",
"only",
"supports",
"update",
"struct",
"field",
"value"
] | 199d20bbfed70dae8c7d4619d4e0d339ce738b43 | https://github.com/graphql-go/graphql/blob/199d20bbfed70dae8c7d4619d4e0d339ce738b43/language/visitor/visitor.go#L488-L521 |
160,796 | graphql-go/graphql | language/visitor/visitor.go | VisitInParallel | func VisitInParallel(visitorOptsSlice ...*VisitorOptions) *VisitorOptions {
skipping := map[int]interface{}{}
return &VisitorOptions{
Enter: func(p VisitFuncParams) (string, interface{}) {
for i, visitorOpts := range visitorOptsSlice {
if _, ok := skipping[i]; !ok {
node, ok := p.Node.(ast.Node)
i... | go | func VisitInParallel(visitorOptsSlice ...*VisitorOptions) *VisitorOptions {
skipping := map[int]interface{}{}
return &VisitorOptions{
Enter: func(p VisitFuncParams) (string, interface{}) {
for i, visitorOpts := range visitorOptsSlice {
if _, ok := skipping[i]; !ok {
node, ok := p.Node.(ast.Node)
i... | [
"func",
"VisitInParallel",
"(",
"visitorOptsSlice",
"...",
"*",
"VisitorOptions",
")",
"*",
"VisitorOptions",
"{",
"skipping",
":=",
"map",
"[",
"int",
"]",
"interface",
"{",
"}",
"{",
"}",
"\n\n",
"return",
"&",
"VisitorOptions",
"{",
"Enter",
":",
"func",
... | // VisitInParallel Creates a new visitor instance which delegates to many visitors to run in
// parallel. Each visitor will be visited for each node before moving on.
//
// If a prior visitor edits a node, no following visitors will see that node. | [
"VisitInParallel",
"Creates",
"a",
"new",
"visitor",
"instance",
"which",
"delegates",
"to",
"many",
"visitors",
"to",
"run",
"in",
"parallel",
".",
"Each",
"visitor",
"will",
"be",
"visited",
"for",
"each",
"node",
"before",
"moving",
"on",
".",
"If",
"a",
... | 199d20bbfed70dae8c7d4619d4e0d339ce738b43 | https://github.com/graphql-go/graphql/blob/199d20bbfed70dae8c7d4619d4e0d339ce738b43/language/visitor/visitor.go#L605-L655 |
160,797 | graphql-go/graphql | language/visitor/visitor.go | VisitWithTypeInfo | func VisitWithTypeInfo(ttypeInfo typeInfo.TypeInfoI, visitorOpts *VisitorOptions) *VisitorOptions {
return &VisitorOptions{
Enter: func(p VisitFuncParams) (string, interface{}) {
if node, ok := p.Node.(ast.Node); ok {
ttypeInfo.Enter(node)
fn := GetVisitFn(visitorOpts, node.GetKind(), false)
if fn != ... | go | func VisitWithTypeInfo(ttypeInfo typeInfo.TypeInfoI, visitorOpts *VisitorOptions) *VisitorOptions {
return &VisitorOptions{
Enter: func(p VisitFuncParams) (string, interface{}) {
if node, ok := p.Node.(ast.Node); ok {
ttypeInfo.Enter(node)
fn := GetVisitFn(visitorOpts, node.GetKind(), false)
if fn != ... | [
"func",
"VisitWithTypeInfo",
"(",
"ttypeInfo",
"typeInfo",
".",
"TypeInfoI",
",",
"visitorOpts",
"*",
"VisitorOptions",
")",
"*",
"VisitorOptions",
"{",
"return",
"&",
"VisitorOptions",
"{",
"Enter",
":",
"func",
"(",
"p",
"VisitFuncParams",
")",
"(",
"string",
... | // VisitWithTypeInfo Creates a new visitor instance which maintains a provided TypeInfo instance
// along with visiting visitor. | [
"VisitWithTypeInfo",
"Creates",
"a",
"new",
"visitor",
"instance",
"which",
"maintains",
"a",
"provided",
"TypeInfo",
"instance",
"along",
"with",
"visiting",
"visitor",
"."
] | 199d20bbfed70dae8c7d4619d4e0d339ce738b43 | https://github.com/graphql-go/graphql/blob/199d20bbfed70dae8c7d4619d4e0d339ce738b43/language/visitor/visitor.go#L659-L693 |
160,798 | graphql-go/graphql | language/lexer/lexer.go | readDigits | func readDigits(s *source.Source, start int, firstCode rune, codeLength int) (int, error) {
body := s.Body
position := start
code := firstCode
if code >= '0' && code <= '9' { // 0 - 9
for {
if code >= '0' && code <= '9' { // 0 - 9
position += codeLength
code, codeLength = runeAt(body, position)
con... | go | func readDigits(s *source.Source, start int, firstCode rune, codeLength int) (int, error) {
body := s.Body
position := start
code := firstCode
if code >= '0' && code <= '9' { // 0 - 9
for {
if code >= '0' && code <= '9' { // 0 - 9
position += codeLength
code, codeLength = runeAt(body, position)
con... | [
"func",
"readDigits",
"(",
"s",
"*",
"source",
".",
"Source",
",",
"start",
"int",
",",
"firstCode",
"rune",
",",
"codeLength",
"int",
")",
"(",
"int",
",",
"error",
")",
"{",
"body",
":=",
"s",
".",
"Body",
"\n",
"position",
":=",
"start",
"\n",
"... | // Returns the new position in the source after reading digits. | [
"Returns",
"the",
"new",
"position",
"in",
"the",
"source",
"after",
"reading",
"digits",
"."
] | 199d20bbfed70dae8c7d4619d4e0d339ce738b43 | https://github.com/graphql-go/graphql/blob/199d20bbfed70dae8c7d4619d4e0d339ce738b43/language/lexer/lexer.go#L197-L216 |
160,799 | graphql-go/graphql | language/lexer/lexer.go | leadingWhitespaceLen | func leadingWhitespaceLen(in string) (n int) {
for _, ch := range in {
if ch == ' ' || ch == '\t' {
n++
} else {
break
}
}
return
} | go | func leadingWhitespaceLen(in string) (n int) {
for _, ch := range in {
if ch == ' ' || ch == '\t' {
n++
} else {
break
}
}
return
} | [
"func",
"leadingWhitespaceLen",
"(",
"in",
"string",
")",
"(",
"n",
"int",
")",
"{",
"for",
"_",
",",
"ch",
":=",
"range",
"in",
"{",
"if",
"ch",
"==",
"' '",
"||",
"ch",
"==",
"'\\t'",
"{",
"n",
"++",
"\n",
"}",
"else",
"{",
"break",
"\n",
"}"... | // leadingWhitespaceLen returns count of whitespace characters on given line. | [
"leadingWhitespaceLen",
"returns",
"count",
"of",
"whitespace",
"characters",
"on",
"given",
"line",
"."
] | 199d20bbfed70dae8c7d4619d4e0d339ce738b43 | https://github.com/graphql-go/graphql/blob/199d20bbfed70dae8c7d4619d4e0d339ce738b43/language/lexer/lexer.go#L422-L431 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.