users: github.com/shurcooL/users Index | Files | Directories

package users

import "github.com/shurcooL/users"

Package users provides a users service definition.

Index

Package Files

users.go

type EditRequest Uses

type EditRequest struct {
}

EditRequest represents a request to edit a user.

type Service Uses

type Service interface {
    // Get fetches the specified user.
    Get(ctx context.Context, user UserSpec) (User, error)

    // GetAuthenticatedSpec fetches the currently authenticated
    // user specification, or UserSpec{ID: 0} if there is no
    // authenticated user. A non-nil error is returned if the
    // the authentication process was not able to successfully
    // determine if a user or no user is currently authenticated.
    GetAuthenticatedSpec(ctx context.Context) (UserSpec, error)

    // GetAuthenticated fetches the currently authenticated user,
    // or User{UserSpec: UserSpec{ID: 0}} if there is no authenticated user.
    GetAuthenticated(ctx context.Context) (User, error)

    // Edit the authenticated user.
    Edit(ctx context.Context, er EditRequest) (User, error)
}

Service for users.

type Store Uses

type Store interface {
    // Create creates the specified user.
    // It returns os.ErrExist if the user already exists.
    Create(ctx context.Context, user User) error

    // Get fetches the specified user.
    Get(ctx context.Context, user UserSpec) (User, error)
}

Store for users.

type User Uses

type User struct {
    UserSpec
    Elsewhere []UserSpec // THINK: Consider merging Elsewhere with root-most UserSpec. Maybe even use a set, order of linked accounts shouldn't matter, should it?

    Login     string
    Name      string
    Email     string // Public email.
    AvatarURL string
    HTMLURL   string

    CreatedAt time.Time
    UpdatedAt time.Time

    SiteAdmin bool
}

User represents a user.

type UserSpec Uses

type UserSpec struct {
    ID     uint64
    Domain string
}

UserSpec specifies a user. ID value 0 represents no user. Valid users may not use 0 as their ID.

Directories

PathSynopsis
asanaapiPackage asanaapi implements users.Service using Asana API client.
fsPackage fs implements an in-memory users.Store backed by a virtual filesystem.
githubapiPackage githubapi implements users.Service using GitHub API client.

Package users imports 2 packages (graph) and is imported by 41 packages. Updated 2017-10-30. Refresh now. Tools for package owners.