Documentation
¶
Overview ¶
Package gqlmodel holds the hand-written Go types that back Githome's GraphQL object types and scalars. The api/graphql resolvers render into these structs so the presenter owns the GraphQL wire shape, mirroring how restmodel owns the REST wire shape. gqlgen autobinds object types to these structs and binds the custom scalars to the marshalers here.
Index ¶
- type Actor
- type Commit
- type DateTime
- type GitObject
- type GitObjectID
- type Issue
- type IssueComment
- type IssueCommentConnection
- type IssueConnection
- type IssueEdge
- type IssueState
- type IssueStateReason
- type Label
- type LabelConnection
- type MergeStateStatus
- type MergeableState
- type PageInfo
- type PatchStatus
- type PullRequest
- type PullRequestChangedFile
- type PullRequestChangedFileConnection
- type PullRequestCommit
- type PullRequestCommitConnection
- type PullRequestConnection
- type PullRequestEdge
- type PullRequestReviewComment
- type PullRequestReviewCommentConnection
- type PullRequestReviewDecision
- type PullRequestReviewThread
- type PullRequestReviewThreadConnection
- type PullRequestState
- type Ref
- type Repository
- type StatusCheckRollup
- type StatusState
- type URI
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Actor ¶
type Actor struct {
Login string // the actor's login
URL URI // the actor's HTML URL
AvatarURL URI // the actor's avatar URL
}
Actor is the GraphQL Actor: the login and URLs gh selects for an issue or comment author. Githome models it as a concrete object carrying the fields the issue documents read; the full Actor interface with the User and Organization implementers arrives with the GraphQL parity milestone.
type Commit ¶
type Commit struct {
Oid GitObjectID
Message string
MessageHeadline string
// RepoOwner and RepoName carry the repository coordinates so the
// statusCheckRollup field resolver can fold the commit's statuses and check
// runs. They are not part of the GraphQL schema, so gqlgen ignores them; the
// presenter fills them.
RepoOwner string
RepoName string
}
Commit is the reduced GraphQL Commit: the object id and the message gh pr view reads. It grows toward GitHub's full Commit with the review milestone.
type DateTime ¶
DateTime is GitHub's DateTime scalar: an ISO 8601 instant in UTC. It marshals to a quoted Zulu string and is used for non-null timestamp fields; nullable timestamps use *DateTime.
func (DateTime) MarshalGQL ¶
MarshalGQL writes the timestamp as a quoted Zulu string.
func (*DateTime) UnmarshalGQL ¶
UnmarshalGQL parses a Zulu string back into a DateTime. DateTime is an output scalar in the M2 schema, so this exists only to satisfy gqlgen's scalar binding, which requires both directions.
type GitObject ¶
type GitObject struct {
Oid GitObjectID
}
GitObject is a git object addressed by its SHA. The M2 schema models it as a concrete type carrying only oid, which is all gh repo view selects; the full GitObject interface with Commit, Tree, Blob, and Tag arrives with the GraphQL parity milestone.
type GitObjectID ¶
type GitObjectID string
GitObjectID is GitHub's GitObjectID scalar: a git object's hex SHA.
func (GitObjectID) MarshalGQL ¶
func (g GitObjectID) MarshalGQL(w io.Writer)
MarshalGQL writes the object id as a quoted string.
func (*GitObjectID) UnmarshalGQL ¶
func (g *GitObjectID) UnmarshalGQL(v any) error
UnmarshalGQL reads a GitObjectID from a JSON string.
type Issue ¶
type Issue struct {
ID string // the Issue node ID
Number int32 // the per-repository issue number
Title string // the issue title
Body string // the issue body, empty string when unset
State IssueState // OPEN or CLOSED
StateReason *IssueStateReason // null until the issue has been closed
URL URI // the issue's HTML URL
Locked bool // whether the conversation is locked
Closed bool // whether the issue is closed
Author *Actor // null for a ghost author
CreatedAt DateTime // creation instant
UpdatedAt DateTime // last-update instant
ClosedAt *DateTime // null while open
Labels *LabelConnection // the attached labels
Comments *IssueCommentConnection
// RepoOwner and RepoName carry the repository coordinates so the comments
// field resolver can page the issue's comments. They are not part of the
// GraphQL schema, so gqlgen ignores them; the presenter fills them.
RepoOwner string
RepoName string
}
Issue is the GraphQL Issue object, reduced to the fields gh issue view and gh issue list select.
type IssueComment ¶
type IssueComment struct {
ID string // the IssueComment node ID
Body string // the comment body
Author *Actor // null for a ghost author
URL URI // the comment's HTML URL
CreatedAt DateTime // creation instant
UpdatedAt DateTime // last-update instant
}
IssueComment is the GraphQL IssueComment object.
type IssueCommentConnection ¶
type IssueCommentConnection struct {
Nodes []*IssueComment
TotalCount int32
}
IssueCommentConnection is the connection over an issue's comments.
type IssueConnection ¶
type IssueConnection struct {
Nodes []*Issue
Edges []*IssueEdge
PageInfo *PageInfo
TotalCount int32
}
IssueConnection is the Relay connection over a repository's issues.
type IssueState ¶
type IssueState string
IssueState is the GraphQL IssueState enum: an issue is OPEN or CLOSED.
const ( IssueStateOpen IssueState = "OPEN" IssueStateClosed IssueState = "CLOSED" )
The IssueState values.
type IssueStateReason ¶
type IssueStateReason string
IssueStateReason is the GraphQL enum for why an issue is in its state. It is null for an open issue that has never been closed.
const ( IssueStateReasonCompleted IssueStateReason = "COMPLETED" IssueStateReasonNotPlanned IssueStateReason = "NOT_PLANNED" IssueStateReasonReopened IssueStateReason = "REOPENED" )
The IssueStateReason values.
type Label ¶
type Label struct {
ID string // the Label node ID
Name string // the label name
Color string // the six-hex color, no leading hash
Description *string // null when unset
}
Label is the GraphQL Label object.
type LabelConnection ¶
LabelConnection is the connection over an issue's or repository's labels. The issue documents read it as nodes plus totalCount, so the page-info and edges a full connection carries are added when a paginated label query needs them.
type MergeStateStatus ¶
type MergeStateStatus string
MergeStateStatus is the GraphQL MergeStateStatus enum, GitHub's richer view of why a pull request can or cannot merge. Githome resolves CLEAN, DIRTY, BEHIND, DRAFT, and UNKNOWN today; BLOCKED, UNSTABLE, and HAS_HOOKS arrive with the review and check milestones that produce them.
const ( MergeStateStatusBehind MergeStateStatus = "BEHIND" MergeStateStatusBlocked MergeStateStatus = "BLOCKED" MergeStateStatusClean MergeStateStatus = "CLEAN" MergeStateStatusDirty MergeStateStatus = "DIRTY" MergeStateStatusDraft MergeStateStatus = "DRAFT" MergeStateStatusHasHooks MergeStateStatus = "HAS_HOOKS" MergeStateStatusUnknown MergeStateStatus = "UNKNOWN" MergeStateStatusUnstable MergeStateStatus = "UNSTABLE" )
The MergeStateStatus values.
type MergeableState ¶
type MergeableState string
MergeableState is the GraphQL MergeableState enum, the tri-state the worker resolves: MERGEABLE for a clean test merge, CONFLICTING for one that conflicts, and UNKNOWN while the recompute has not yet run.
const ( MergeableStateMergeable MergeableState = "MERGEABLE" MergeableStateConflicting MergeableState = "CONFLICTING" MergeableStateUnknown MergeableState = "UNKNOWN" )
The MergeableState values.
type PageInfo ¶
type PageInfo struct {
HasNextPage bool
HasPreviousPage bool
StartCursor *string
EndCursor *string
}
PageInfo is the Relay page-info shared by every connection.
type PatchStatus ¶
type PatchStatus string
PatchStatus is the GraphQL PatchStatus enum: how a file changed across a pull request's diff.
const ( PatchStatusAdded PatchStatus = "ADDED" PatchStatusDeleted PatchStatus = "DELETED" PatchStatusModified PatchStatus = "MODIFIED" PatchStatusRenamed PatchStatus = "RENAMED" PatchStatusCopied PatchStatus = "COPIED" PatchStatusChanged PatchStatus = "CHANGED" )
The PatchStatus values.
type PullRequest ¶
type PullRequest struct {
ID string // the PullRequest node ID
Number int32 // the per-repository pull request number
Title string // the pull request title
Body string // the body, empty string when unset
State PullRequestState // OPEN, CLOSED, or MERGED
URL URI // the pull request's HTML URL
Locked bool // whether the conversation is locked
Closed bool // whether the pull request is closed or merged
IsDraft bool // whether the pull request is a draft
Merged bool // whether the pull request has merged
MergedAt *DateTime // null while unmerged
Mergeable MergeableState // the tri-state mergeable
MergeStateStatus MergeStateStatus // the richer merge state
Author *Actor // null for a ghost author
BaseRefName string // the base branch name
HeadRefName string // the head branch name
BaseRefOid GitObjectID // the recorded base tip
HeadRefOid GitObjectID // the recorded head tip
Additions int32 // lines added across the diff
Deletions int32 // lines removed across the diff
ChangedFiles int32 // files touched by the diff
CreatedAt DateTime // creation instant
UpdatedAt DateTime // last-update instant
ClosedAt *DateTime // null while open
// RepoOwner and RepoName carry the repository coordinates so the files and
// commits field resolvers can read them through the domain. They are not part
// of the GraphQL schema, so gqlgen ignores them; the presenter fills them.
RepoOwner string
RepoName string
}
PullRequest is the GraphQL PullRequest object, reduced to the fields gh pr view and gh pr diff select. mergeable and mergeStateStatus are the worker-resolved merge view; until the recompute runs mergeable is UNKNOWN and mergeStateStatus is UNKNOWN.
type PullRequestChangedFile ¶
type PullRequestChangedFile struct {
Path string
Additions int32
Deletions int32
ChangeType PatchStatus
}
PullRequestChangedFile is one file's change in a pull request's diff.
type PullRequestChangedFileConnection ¶
type PullRequestChangedFileConnection struct {
Nodes []*PullRequestChangedFile
TotalCount int32
}
PullRequestChangedFileConnection is the connection over a pull request's changed files.
type PullRequestCommit ¶
PullRequestCommit is one commit on a pull request, wrapping the underlying git commit the way GitHub's schema nests it.
type PullRequestCommitConnection ¶
type PullRequestCommitConnection struct {
Nodes []*PullRequestCommit
TotalCount int32
}
PullRequestCommitConnection is the connection over a pull request's commits.
type PullRequestConnection ¶
type PullRequestConnection struct {
Nodes []*PullRequest
Edges []*PullRequestEdge
PageInfo *PageInfo
TotalCount int32
}
PullRequestConnection is the Relay connection over a repository's pull requests.
type PullRequestEdge ¶
type PullRequestEdge struct {
Cursor string
Node *PullRequest
}
PullRequestEdge pairs a pull request with its opaque pagination cursor.
type PullRequestReviewComment ¶
type PullRequestReviewComment struct {
ID string // the PullRequestReviewComment node ID
Body string // the comment body
Path string // the file the comment anchors to
Author *Actor // null for a ghost author
Outdated bool // whether the anchored line left the diff
URL URI // the comment's HTML URL
CreatedAt DateTime
}
PullRequestReviewComment is the GraphQL view of one inline review comment.
type PullRequestReviewCommentConnection ¶
type PullRequestReviewCommentConnection struct {
Nodes []*PullRequestReviewComment
TotalCount int32
}
PullRequestReviewCommentConnection is the connection over a thread's comments.
type PullRequestReviewDecision ¶
type PullRequestReviewDecision string
PullRequestReviewDecision is the GraphQL enum for a pull request's derived review state. Githome computes APPROVED and CHANGES_REQUESTED from the reviews; REVIEW_REQUIRED needs branch protection and arrives with that milestone.
const ( PullRequestReviewDecisionChangesRequested PullRequestReviewDecision = "CHANGES_REQUESTED" PullRequestReviewDecisionApproved PullRequestReviewDecision = "APPROVED" PullRequestReviewDecisionReviewRequired PullRequestReviewDecision = "REVIEW_REQUIRED" )
The PullRequestReviewDecision values.
type PullRequestReviewThread ¶
type PullRequestReviewThread struct {
ID string // the PullRequestReviewThread node ID
IsResolved bool // whether the conversation is resolved
IsOutdated bool // whether the anchored line left the diff
Path string // the file the thread anchors to
Line *int32 // the anchored line, null when the thread is file-level
Comments *PullRequestReviewCommentConnection
}
PullRequestReviewThread is the GraphQL view of a review conversation: a root comment and its replies. ID is the thread node id; the comments field is paged by its own resolver, so the presenter fills the connection the resolver returns.
type PullRequestReviewThreadConnection ¶
type PullRequestReviewThreadConnection struct {
Nodes []*PullRequestReviewThread
TotalCount int32
}
PullRequestReviewThreadConnection is the connection over a pull request's review threads.
type PullRequestState ¶
type PullRequestState string
PullRequestState is the GraphQL PullRequestState enum: a pull request is OPEN, CLOSED, or MERGED. A merged pull request reports MERGED even though its issue is closed, the distinction GitHub draws.
const ( PullRequestStateOpen PullRequestState = "OPEN" PullRequestStateClosed PullRequestState = "CLOSED" PullRequestStateMerged PullRequestState = "MERGED" )
The PullRequestState values.
type Ref ¶
type Ref struct {
Name string // the short ref name, such as main
Target *GitObject // the object the ref names
}
Ref is a git reference reduced to its name and the object it points at.
type Repository ¶
type Repository struct {
ID string // the Repository node ID
Name string // the short repository name
NameWithOwner string // owner login + "/" + name
Description *string // null when unset
IsPrivate bool // visibility
CreatedAt DateTime // creation instant
PushedAt *DateTime // last push, null for a repository with no commits
URL URI // the repository's HTML URL
DefaultBranchRef *Ref // the head branch, null for an empty repository
}
Repository is the GraphQL Repository object, reduced to the fields the M2 surface serves: the set gh repo view selects. Later milestones grow it toward the full GitHub Repository type. Nullable GraphQL fields use Go pointers so gqlgen renders null rather than a zero value.
type StatusCheckRollup ¶
type StatusCheckRollup struct {
State StatusState
}
StatusCheckRollup is the GraphQL view of a head commit's combined status and check state.
type StatusState ¶
type StatusState string
StatusState is the GraphQL enum for a rollup or status state, worst first.
const ( StatusStateError StatusState = "ERROR" StatusStateExpected StatusState = "EXPECTED" StatusStateFailure StatusState = "FAILURE" StatusStatePending StatusState = "PENDING" StatusStateSuccess StatusState = "SUCCESS" )
The StatusState values.
type URI ¶
type URI string
URI is GitHub's URI scalar: an absolute URL rendered as a JSON string.
func (URI) MarshalGQL ¶
MarshalGQL writes the URI as a quoted string.
func (*URI) UnmarshalGQL ¶
UnmarshalGQL reads a URI from a JSON string.