person

package
v0.0.27 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 8, 2014 License: BSD-3-Clause, MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StatAuthors            = "authors"
	StatClients            = "clients"
	StatOwnedRepos         = "owned-repos"
	StatContributedToRepos = "contributed-to-repos"
	StatDependencies       = "dependencies"
	StatDependents         = "dependents"
	StatDefs               = "defs"
	StatExportedDefs       = "exported-defs"
)
View Source
const DefaultAvatarSize = 128

DefaultAvatarSize is the size, in pixels, of avatar images if no size is specified.

Variables

View Source
var ErrNotExist = errors.New("user does not exist")

ErrNotExist is an error indicating that no such user exists.

Functions

func GravatarURL

func GravatarURL(email string, size uint16) string

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 StatType

type StatType string

func (*StatType) Scan

func (x *StatType) Scan(v interface{}) error

func (StatType) Value

func (x StatType) Value() (driver.Value, error)

type Stats

type Stats map[StatType]int

type UID

type UID int

UID is the numeric primary key for a user.

func (*UID) Scan

func (x *UID) Scan(v interface{}) error

Scan implements database/sql.Scanner.

func (UID) Value

func (x UID) Value() (driver.Value, error)

Value implements database/sql/driver.Valuer.

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 (u *User) AvatarURLOfSize(width int) string

func (*User) CanAttributeCodeTo

func (u *User) CanAttributeCodeTo() bool

CanAttributeCodeTo is whether this user can commit code. It is false for organizations and true for both users and transient users.

func (*User) CanOwnRepositories

func (u *User) CanOwnRepositories() bool

CanOwnRepositories is whether the user is capable of owning repositories (e.g., GitHub users can own GitHub repositories).

func (*User) CanSync

func (u *User) CanSync() bool

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

func (u *User) GitHubLogin() string

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

func (u *User) IsOrganization() bool

IsOrganization is whether this user represents a GitHub organization (which are treated as a subclass of User in GitHub's data model).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL