Documentation ¶
Index ¶
- Constants
- Variables
- func DisplayName(timerange *models.Timerange, synonyms *models.SynonymList, ...) (string, error)
- func NormalizeTopicName(name string) (string, bool)
- type CleanupFunc
- type CompleteRegistration
- type CompleteRegistrationResult
- type Connection
- func (c Connection) CreateGithubAccount(ctx context.Context, user *models.User, ...) (*CreateGithubAccountResult, error)
- func (c Connection) CreateGithubSession(ctx context.Context, ...) (*CreateSessionResult, error)
- func (c Connection) CreateGoogleAccount(ctx context.Context, user *models.User, ...) (*CreateGoogleAccountResult, error)
- func (c Connection) CreateGoogleSession(ctx context.Context, name, primaryEmail, profileID, googleAvatarURL string) (*CreateSessionResult, error)
- func (c Connection) DeleteAccount(ctx context.Context, user *models.User) (*DeleteAccountResult, error)
- func (c Connection) DeleteLink(ctx context.Context, repo *models.Repository, link *models.Link) (*DeleteLinkResult, error)
- func (c Connection) DeleteTopicTimeRange(ctx context.Context, topic *models.Topic) (*DeleteTopicTimeRangeResult, error)
- func (c Connection) ReviewLink(ctx context.Context, link *models.Link, reviewed bool) (*ReviewLinkResult, error)
- func (c Connection) UpdateSynonyms(ctx context.Context, topic *models.Topic, synonyms []models.Synonym) (*UpdateSynonymsResult, error)
- func (c Connection) UpdateTopic(ctx context.Context, topic *models.Topic, name string, description *string) (*UpdateTopicResult, error)
- func (c Connection) UpsertTopic(ctx context.Context, repo *models.Repository, name string, description *string, ...) (*UpsertTopicResult, error)
- func (c Connection) UpsertTopicTimeRange(ctx context.Context, topic *models.Topic, startsAt time.Time, ...) (*UpsertTopicTimeRangeResult, error)
- type CreateGithubAccountResult
- type CreateGoogleAccountResult
- type CreateRepository
- type CreateRepositoryResult
- type CreateSessionResult
- type CreateUser
- type CreateUserResult
- type DeleteAccountResult
- type DeleteLinkResult
- type DeleteTopic
- type DeleteTopicResult
- type DeleteTopicTimeRangeResult
- type ReviewLinkResult
- type UpdateLinkTopics
- type UpdateLinkTopicsResult
- type UpdateSynonymsResult
- type UpdateTopicParentTopics
- type UpdateTopicParentTopicsResult
- type UpdateTopicResult
- type UpsertLink
- type UpsertLinkResult
- type UpsertTopicResult
- type UpsertTopicTimeRangeResult
Constants ¶
const ( PublicOrgID = "45dc89a6-e6f0-11e8-8bc1-6f4d565e3ddb" PublicRootTopicID = "df63295e-ee02-11e8-9e36-17d56b662bc8" )
Hard-coded constants.
Variables ¶
var (
ErrInvalidLogin = errors.New("not a valid login")
)
Error constants.
Functions ¶
func DisplayName ¶
func DisplayName( timerange *models.Timerange, synonyms *models.SynonymList, locale models.LocaleIdentifier, ) (string, error)
DisplayName constructs a display name from a SynonymList and a Timerange.
func NormalizeTopicName ¶
NormalizeTopicName returns a normalized topic name and indicates whether the name is valid.
Types ¶
type CleanupFunc ¶
type CleanupFunc func() error
CleanupFunc is a function that can be called to roll back the effects of a service call.
type CompleteRegistration ¶
CompleteRegistration holds information for completing a registration.
func (CompleteRegistration) Call ¶
func (m CompleteRegistration) Call(ctx context.Context, exec boil.ContextExecutor) (*CompleteRegistrationResult, error)
Call finishes the registration process by creating an organization and a repo for the user.
type CompleteRegistrationResult ¶
type CompleteRegistrationResult struct { *CreateRepositoryResult Alerts []*models.Alert Organization *models.Organization }
CompleteRegistrationResult holds the result of a CreateUser call.
type Connection ¶
Connection holds fields used by service calls.
func New ¶
func New( exec boil.ContextExecutor, actor *models.User, fetcher pageinfo.Fetcher, ) *Connection
New returns a new service connection
func (Connection) CreateGithubAccount ¶
func (c Connection) CreateGithubAccount( ctx context.Context, user *models.User, username, name, primaryEmail, avatarURL string, ) (*CreateGithubAccountResult, error)
CreateGithubAccount creates a new github account.
func (Connection) CreateGithubSession ¶
func (c Connection) CreateGithubSession( ctx context.Context, name, primaryEmail, githubUsername, githubAvatarURL string, ) (*CreateSessionResult, error)
CreateGithubSession creates a new session for the user. If the user is not found in the database, a new user is created.
func (Connection) CreateGoogleAccount ¶
func (c Connection) CreateGoogleAccount( ctx context.Context, user *models.User, profileID, name, primaryEmail, avatarURL string, ) (*CreateGoogleAccountResult, error)
CreateGoogleAccount creates a new github account.
func (Connection) CreateGoogleSession ¶
func (c Connection) CreateGoogleSession( ctx context.Context, name, primaryEmail, profileID, googleAvatarURL string, ) (*CreateSessionResult, error)
CreateGoogleSession creates a new session for the user. If the user is not found in the database, a new user is created.
func (Connection) DeleteAccount ¶
func (c Connection) DeleteAccount( ctx context.Context, user *models.User, ) (*DeleteAccountResult, error)
DeleteAccount hard-deletes the account and any private data associated with it. Topics and links added to public repos are not deleted.
func (Connection) DeleteLink ¶
func (c Connection) DeleteLink( ctx context.Context, repo *models.Repository, link *models.Link, ) (*DeleteLinkResult, error)
DeleteLink removes a link from a repo.
func (Connection) DeleteTopicTimeRange ¶
func (c Connection) DeleteTopicTimeRange( ctx context.Context, topic *models.Topic, ) (*DeleteTopicTimeRangeResult, error)
DeleteTopicTimeRange removes a time range from a topic.
func (Connection) ReviewLink ¶
func (c Connection) ReviewLink( ctx context.Context, link *models.Link, reviewed bool, ) (*ReviewLinkResult, error)
ReviewLink toggles whether a link has been reviewed.
func (Connection) UpdateSynonyms ¶
func (c Connection) UpdateSynonyms( ctx context.Context, topic *models.Topic, synonyms []models.Synonym, ) (*UpdateSynonymsResult, error)
UpdateSynonyms updates the synonyms of the topic.
func (Connection) UpdateTopic ¶
func (c Connection) UpdateTopic( ctx context.Context, topic *models.Topic, name string, description *string, ) (*UpdateTopicResult, error)
UpdateTopic updates fields on the topic.
func (Connection) UpsertTopic ¶
func (c Connection) UpsertTopic( ctx context.Context, repo *models.Repository, name string, description *string, parentTopicIds []string, ) (*UpsertTopicResult, error)
UpsertTopic updates a topic if it exists and creates it if it does not exist.
func (Connection) UpsertTopicTimeRange ¶
func (c Connection) UpsertTopicTimeRange( ctx context.Context, topic *models.Topic, startsAt time.Time, endsAt *time.Time, format models.TimeRangePrefixFormat, ) (*UpsertTopicTimeRangeResult, error)
UpsertTopicTimeRange adds a timeline to a topic.
type CreateGithubAccountResult ¶
type CreateGithubAccountResult struct { Alerts []*models.Alert Account *models.GithubAccount }
CreateGithubAccountResult holds the result of attempting to create a new Github account.
type CreateGoogleAccountResult ¶
type CreateGoogleAccountResult struct { Alerts []*models.Alert Account *models.GoogleAccount }
CreateGoogleAccountResult holds the result of attempting to create a new Github account.
type CreateRepository ¶
type CreateRepository struct { Organization *models.Organization Name string Owner *models.User System bool }
CreateRepository holds parameters for creating a new repository.
func (*CreateRepository) Call ¶
func (m *CreateRepository) Call(ctx context.Context, exec boil.ContextExecutor) (*CreateRepositoryResult, error)
Call adds a new repository to the database.
type CreateRepositoryResult ¶
type CreateRepositoryResult struct { Repository *models.Repository RootTopic *models.Topic }
CreateRepositoryResult holds the result of a CreateRepository service call.
type CreateSessionResult ¶
type CreateSessionResult struct { Alerts []*models.Alert Cleanup CleanupFunc Session *models.Session User *models.User }
CreateSessionResult holds the result of a Create{Github,Google}Session service call.
type CreateUser ¶
CreateUser holds the information needed to create a new user.
func (CreateUser) Call ¶
func (m CreateUser) Call(ctx context.Context, exec boil.ContextExecutor) (*CreateUserResult, error)
Call creates a new user and provides a default organization and repo for him/her.
type CreateUserResult ¶
CreateUserResult holds the result of a CreateUser call.
type DeleteAccountResult ¶
DeleteAccountResult holds the result of deleting an account.
type DeleteLinkResult ¶
type DeleteLinkResult struct { Cleanup CleanupFunc DeletedLinkID string }
DeleteLinkResult holds the result of a DeleteLink call.
type DeleteTopic ¶
DeleteTopic deletes a topic and associated relations.
func (DeleteTopic) Call ¶
func (m DeleteTopic) Call(ctx context.Context, exec boil.ContextExecutor) (*DeleteTopicResult, error)
Call removes a time range from a topic.
type DeleteTopicResult ¶
DeleteTopicResult holds the result of an attempt to delete a topic.
type DeleteTopicTimeRangeResult ¶
type DeleteTopicTimeRangeResult struct { Alerts []*models.Alert Topic *models.Topic DeletedTimeRangeID *string }
DeleteTopicTimeRangeResult holds the result of an attempt to delete the time range on a topic.
type ReviewLinkResult ¶
type ReviewLinkResult struct { Link *models.Link Review *models.UserLinkReview }
ReviewLinkResult holds the result of a ReviewLink call.
type UpdateLinkTopics ¶
UpdateLinkTopics is used to update the topics on a link. If there are no topics, the link is added to the "Everything" topic. The link_transitive_closure table is also updated.
func (UpdateLinkTopics) Call ¶
func (s UpdateLinkTopics) Call(ctx context.Context, exec boil.ContextExecutor) (*UpdateLinkTopicsResult, error)
Call executes the mutation
type UpdateLinkTopicsResult ¶
UpdateLinkTopicsResult holds the result of an updating of the topics on a link
type UpdateSynonymsResult ¶
UpdateSynonymsResult holds the result after updating the synonyms on a topic.
type UpdateTopicParentTopics ¶
type UpdateTopicParentTopics struct { Actor *models.User Topic *models.TopicValue ParentTopicIds []string }
UpdateTopicParentTopics updates the parent topics of a topic
func (UpdateTopicParentTopics) Call ¶
func (m UpdateTopicParentTopics) Call(ctx context.Context, exec boil.ContextExecutor) (*UpdateTopicParentTopicsResult, error)
Call updates the parent topics of a topic.
type UpdateTopicParentTopicsResult ¶
type UpdateTopicParentTopicsResult struct { Alerts []*models.Alert Topic *models.TopicValue }
UpdateTopicParentTopicsResult holds the result of an UpdateTopicParentTopics call.
type UpdateTopicResult ¶
UpdateTopicResult holds the result of an UpdateTopic call.
type UpsertLink ¶
type UpsertLink struct { Actor *models.User Fetcher pageinfo.Fetcher ParentTopicIds []string ProvidedTitle *string ProvidedURL string Repository *models.Repository }
UpsertLink adds a link if it does not yet exist in the database or updates information about the link if it is found.
func (UpsertLink) Call ¶
func (m UpsertLink) Call(ctx context.Context, exec boil.ContextExecutor) (*UpsertLinkResult, error)
Call performs the mutation
type UpsertLinkResult ¶
UpsertLinkResult holds the result of an UpsertLink call.
type UpsertTopicResult ¶
UpsertTopicResult holds the result of an UpsertTopic call.