Documentation ¶
Index ¶
Constants ¶
const ( StatAuthors = "authors" StatClients = "clients" StatOwnedRepos = "owned-repos" StatContributedToRepos = "contributed-to-repos" StatDependencies = "dependencies" StatDependents = "dependents" StatDefs = "defs" StatExportedDefs = "exported-defs" )
const DefaultAvatarSize = 128
DefaultAvatarSize is the size, in pixels, of avatar images if no size is specified.
Variables ¶
var ErrNotExist = errors.New("user does not exist")
ErrNotExist is an error indicating that no such user exists.
Functions ¶
func GravatarURL ¶
GravatarURL returns the URL to the Gravatar avatar image for email. If size is 0, DefaultAvatarSize is used.
Types ¶
type ErrRenamed ¶
type ErrRenamed struct { // OldLogin is the previous login name. OldLogin string // NewLogin is what the old login was renamed to. NewLogin string }
ErrRenamed is an error type that indicates that a user account was renamed from OldLogin to NewLogin.
func (ErrRenamed) Error ¶
func (e ErrRenamed) Error() string
type User ¶
type User struct { // UID is the numeric primary key for a user. UID UID `db:"uid"` // GitHubID is the numeric ID of the GitHub user account corresponding to // this user. GitHubID nnz.Int `db:"github_id"` // Login is the user's username, which typically corresponds to the user's // GitHub login. Login string // Name is the (possibly empty) full name of the user. Name string // Type is either "User" or "Organization". Type string // AvatarURL is the URL to an avatar image specified by the user. AvatarURL string // Location is the user's physical location (from their GitHub profile). Location string `json:",omitempty"` // Company is the user's company (from their GitHub profile). Company string `json:",omitempty"` // HomepageURL is the user's homepage or blog URL (from their GitHub // profile). HomepageURL string `db:"homepage_url" json:",omitempty"` // Transient is if this user was constructed on the fly and is not persisted // or resolved to a Sourcegraph/GitHub/etc. user. Transient bool `db:"-" json:",omitempty"` // UserProfileDisabled is whether the user profile should not be displayed // on the Web app. UserProfileDisabled bool `db:"user_profile_disabled" json:",omitempty"` // RegisteredAt is the date that the user registered. If the user has not // registered (i.e., we have processed their repos but they haven't signed // into Sourcegraph), it is null. RegisteredAt db_common.NullTime `db:"registered_at"` }
User represents a user.
func (*User) AvatarURLOfSize ¶
func (*User) CanAttributeCodeTo ¶
CanAttributeCodeTo is whether this user can commit code. It is false for organizations and true for both users and transient users.
func (*User) CanOwnRepositories ¶
CanOwnRepositories is whether the user is capable of owning repositories (e.g., GitHub users can own GitHub repositories).
func (*User) CanSync ¶
CanSync is whether this person can be synced with the external source that the person was originally fetched from (e.g., GitHub users).
func (*User) GitHubLogin ¶
GitHubLogin returns the user's Login. They are the same for now, but callers that intend to get the GitHub login should call GitHubLogin() so that we can decouple the logins in the future if needed.
func (*User) IsOrganization ¶
IsOrganization is whether this user represents a GitHub organization (which are treated as a subclass of User in GitHub's data model).