Documentation ¶
Index ¶
- Constants
- Variables
- func ClearRequestSession(ctx context.Context) context.Context
- func WithRequestContext(ctx context.Context, rc *RequestContext) context.Context
- func WithViewer(ctx context.Context, exec boil.ContextExecutor, viewerID, sessionID string) (*models.User, error)
- type ByName
- type MutationResolver
- func (r *MutationResolver) CreateGithubSession(ctx context.Context, input models.CreateGithubSessionInput) (*models.CreateSessionPayload, error)
- func (r *MutationResolver) CreateGoogleSession(ctx context.Context, input models.CreateGoogleSessionInput) (*models.CreateSessionPayload, error)
- func (r *MutationResolver) DeleteAccount(ctx context.Context, input models.DeleteAccountInput) (*models.DeleteAccountPayload, error)
- func (r *MutationResolver) DeleteLink(ctx context.Context, input models.DeleteLinkInput) (*models.DeleteLinkPayload, error)
- func (r *MutationResolver) DeleteSession(ctx context.Context, input models.DeleteSessionInput) (*models.DeleteSessionPayload, error)
- func (r *MutationResolver) DeleteTopic(ctx context.Context, input models.DeleteTopicInput) (*models.DeleteTopicPayload, error)
- func (r *MutationResolver) DeleteTopicTimeRange(ctx context.Context, input models.DeleteTopicTimeRangeInput) (*models.DeleteTopicTimeRangePayload, error)
- func (r *MutationResolver) ReviewLink(ctx context.Context, input models.ReviewLinkInput) (*models.ReviewLinkPayload, error)
- func (r *MutationResolver) SelectRepository(ctx context.Context, input models.SelectRepositoryInput) (*models.SelectRepositoryPayload, error)
- func (r *MutationResolver) UpdateLinkTopics(ctx context.Context, input models.UpdateLinkTopicsInput) (*models.UpdateLinkTopicsPayload, error)
- func (r *MutationResolver) UpdateSynonyms(ctx context.Context, input models.UpdateSynonymsInput) (*models.UpdateSynonymsPayload, error)
- func (r *MutationResolver) UpdateTopic(ctx context.Context, input models.UpdateTopicInput) (*models.UpdateTopicPayload, error)
- func (r *MutationResolver) UpdateTopicParentTopics(ctx context.Context, input models.UpdateTopicParentTopicsInput) (*models.UpdateTopicParentTopicsPayload, error)
- func (r *MutationResolver) UpsertLink(ctx context.Context, input models.UpsertLinkInput) (*models.UpsertLinkPayload, error)
- func (r *MutationResolver) UpsertTopic(ctx context.Context, input models.UpsertTopicInput) (*models.UpsertTopicPayload, error)
- func (r *MutationResolver) UpsertTopicTimeRange(ctx context.Context, input models.UpsertTopicTimeRangeInput) (*models.UpsertTopicTimeRangePayload, error)
- type RequestContext
- func (c *RequestContext) InitiatedByServer(serverSecret string) bool
- func (c *RequestContext) ServerSecret() string
- func (c *RequestContext) SetServerSecret(secret string)
- func (c *RequestContext) SetView(view *models.View)
- func (c *RequestContext) SetViewer(viewer *models.User)
- func (c *RequestContext) View() *models.View
- func (c *RequestContext) Viewer() *models.User
- type Resolver
- func (r *Resolver) Link() models.LinkResolver
- func (r *Resolver) Mutation() models.MutationResolver
- func (r *Resolver) Organization() models.OrganizationResolver
- func (r *Resolver) Query() models.QueryResolver
- func (r *Resolver) Repository() models.RepositoryResolver
- func (r *Resolver) Synonym() models.SynonymResolver
- func (r *Resolver) Topic() models.TopicResolver
- func (r *Resolver) User() models.UserResolver
- func (r *Resolver) View() models.ViewResolver
Constants ¶
const ( EverythingTopicPath = "/wiki/topics/df63295e-ee02-11e8-9e36-17d56b662bc8" TestSessionID = "f1aaed32-7548-4f7c-920e-d4dc9172e475" )
CurrentUserKey is the key used for storing the current user in the session.
Variables ¶
var ( GuestViewer = &models.User{Name: "Anonymous", ID: models.GuestUserID} GuestView = &models.View{} GuestRequestContext = &RequestContext{view: GuestView, viewer: GuestViewer} )
Default constants for use in a guest context.
var ( ErrNoAnonymousMutations = errors.New("anonymous users cannot make updates or deletions") )
Special errors.
Functions ¶
func ClearRequestSession ¶
ClearRequestSession removes the current request session from the context.
func WithRequestContext ¶
func WithRequestContext(ctx context.Context, rc *RequestContext) context.Context
WithRequestContext adds the specified request context object to the context.
func WithViewer ¶
func WithViewer( ctx context.Context, exec boil.ContextExecutor, viewerID, sessionID string, ) (*models.User, error)
WithViewer looks up the viewer for the session ID provided, makes sure they match, and adds the result to the request context.
Types ¶
type ByName ¶
type ByName struct {
// contains filtered or unexported fields
}
ByName provides a way to sort a topic by name.
type MutationResolver ¶
type MutationResolver struct {
*Resolver
}
MutationResolver holds configuration information for a mutation.
func (*MutationResolver) CreateGithubSession ¶
func (r *MutationResolver) CreateGithubSession( ctx context.Context, input models.CreateGithubSessionInput, ) (*models.CreateSessionPayload, error)
CreateGithubSession creates a new session for the user passed in, possibly alongside any existing sessions. If the user is not yet in the database, a new user is created. Sessions are destroyed using DestroySession, which is called when someone logs out of the client.
func (*MutationResolver) CreateGoogleSession ¶
func (r *MutationResolver) CreateGoogleSession( ctx context.Context, input models.CreateGoogleSessionInput, ) (*models.CreateSessionPayload, error)
CreateGoogleSession creates a new session for the user passed in. See CreateGithubSession for details.
func (*MutationResolver) DeleteAccount ¶
func (r *MutationResolver) DeleteAccount( ctx context.Context, input models.DeleteAccountInput, ) (*models.DeleteAccountPayload, error)
DeleteAccount deletes the user account and any private data associated with it. Links and topics added to the public repo will not be removed, but the association between the user and the links and topics will no longer exist.
func (*MutationResolver) DeleteLink ¶
func (r *MutationResolver) DeleteLink( ctx context.Context, input models.DeleteLinkInput, ) (*models.DeleteLinkPayload, error)
DeleteLink sets the parent topics on a topic.
func (*MutationResolver) DeleteSession ¶
func (r *MutationResolver) DeleteSession( ctx context.Context, input models.DeleteSessionInput, ) (*models.DeleteSessionPayload, error)
DeleteSession deletes a user session.
func (*MutationResolver) DeleteTopic ¶
func (r *MutationResolver) DeleteTopic( ctx context.Context, input models.DeleteTopicInput, ) (*models.DeleteTopicPayload, error)
DeleteTopic deletes a topic.
func (*MutationResolver) DeleteTopicTimeRange ¶
func (r *MutationResolver) DeleteTopicTimeRange( ctx context.Context, input models.DeleteTopicTimeRangeInput, ) (*models.DeleteTopicTimeRangePayload, error)
DeleteTopicTimeRange deletes a topic.
func (*MutationResolver) ReviewLink ¶
func (r *MutationResolver) ReviewLink( ctx context.Context, input models.ReviewLinkInput, ) (*models.ReviewLinkPayload, error)
ReviewLink marks a link reviewed.
func (*MutationResolver) SelectRepository ¶
func (r *MutationResolver) SelectRepository( ctx context.Context, input models.SelectRepositoryInput, ) (*models.SelectRepositoryPayload, error)
SelectRepository selects the repository for the current user.
func (*MutationResolver) UpdateLinkTopics ¶
func (r *MutationResolver) UpdateLinkTopics( ctx context.Context, input models.UpdateLinkTopicsInput, ) (*models.UpdateLinkTopicsPayload, error)
UpdateLinkTopics sets the parent topics on a link.
func (*MutationResolver) UpdateSynonyms ¶
func (r *MutationResolver) UpdateSynonyms( ctx context.Context, input models.UpdateSynonymsInput, ) (*models.UpdateSynonymsPayload, error)
UpdateSynonyms updates the synonyms for a topic.
func (*MutationResolver) UpdateTopic ¶
func (r *MutationResolver) UpdateTopic( ctx context.Context, input models.UpdateTopicInput, ) (*models.UpdateTopicPayload, error)
UpdateTopic updates the fields on a topic.
func (*MutationResolver) UpdateTopicParentTopics ¶
func (r *MutationResolver) UpdateTopicParentTopics( ctx context.Context, input models.UpdateTopicParentTopicsInput, ) (*models.UpdateTopicParentTopicsPayload, error)
UpdateTopicParentTopics sets the parent topics on a topic.
func (*MutationResolver) UpsertLink ¶
func (r *MutationResolver) UpsertLink( ctx context.Context, input models.UpsertLinkInput, ) (*models.UpsertLinkPayload, error)
UpsertLink adds a new link to the database.
func (*MutationResolver) UpsertTopic ¶
func (r *MutationResolver) UpsertTopic( ctx context.Context, input models.UpsertTopicInput, ) (*models.UpsertTopicPayload, error)
UpsertTopic creates a new topic.
func (*MutationResolver) UpsertTopicTimeRange ¶
func (r *MutationResolver) UpsertTopicTimeRange( ctx context.Context, input models.UpsertTopicTimeRangeInput, ) (*models.UpsertTopicTimeRangePayload, error)
UpsertTopicTimeRange adds a timeline to a topic.
type RequestContext ¶
type RequestContext struct {
// contains filtered or unexported fields
}
RequestContext holds information about the current request.
func GetRequestContext ¶
func GetRequestContext(ctx context.Context) *RequestContext
GetRequestContext returns the current request context.
func NewRequestContext ¶
func NewRequestContext(viewer *models.User) *RequestContext
NewRequestContext returns a new *RequestContext object initialized with the parameters passed in.
func (*RequestContext) InitiatedByServer ¶
func (c *RequestContext) InitiatedByServer(serverSecret string) bool
InitiatedByServer returns true if the GraphQL operation provides proof that it originated from the node server rather than being proxied from the client.
func (*RequestContext) ServerSecret ¶
func (c *RequestContext) ServerSecret() string
ServerSecret returns the value to be used for proof that a request originates from the server rather than being proxied through the client.
func (*RequestContext) SetServerSecret ¶
func (c *RequestContext) SetServerSecret(secret string)
SetServerSecret adds a secret to the request context that can be used to verify that the request originates from the server rather than one that is proxied from the client.
func (*RequestContext) SetView ¶
func (c *RequestContext) SetView(view *models.View)
SetView sets the current view.
func (*RequestContext) SetViewer ¶
func (c *RequestContext) SetViewer(viewer *models.User)
SetViewer sets the current viewer.
func (*RequestContext) View ¶
func (c *RequestContext) View() *models.View
View returns the current view.
func (*RequestContext) Viewer ¶
func (c *RequestContext) Viewer() *models.User
Viewer returns the current viewer.
type Resolver ¶
Resolver is the abstract base class for resolvers.
func (*Resolver) Link ¶
func (r *Resolver) Link() models.LinkResolver
Link returns an instance of models.LinkResolver.
func (*Resolver) Mutation ¶
func (r *Resolver) Mutation() models.MutationResolver
Mutation returns a resolver that can be used for issuing mutations.
func (*Resolver) Organization ¶
func (r *Resolver) Organization() models.OrganizationResolver
Organization returns an instance of models.OrganizationResolver.
func (*Resolver) Query ¶
func (r *Resolver) Query() models.QueryResolver
Query returns a resolver that can be used for issuing queries.
func (*Resolver) Repository ¶
func (r *Resolver) Repository() models.RepositoryResolver
Repository returns an instance of models.LinkResolver.
func (*Resolver) Synonym ¶
func (r *Resolver) Synonym() models.SynonymResolver
Synonym returns an instance of models.SynonymResolver.
func (*Resolver) Topic ¶
func (r *Resolver) Topic() models.TopicResolver
Topic returns an instance of models.TopicResolver.
func (*Resolver) User ¶
func (r *Resolver) User() models.UserResolver
User returns an instance of models.UserResolver.
func (*Resolver) View ¶
func (r *Resolver) View() models.ViewResolver
View returns an instance of models.ViewResolver