user

package
v0.0.0-...-bcf6333 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2018 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type QueryRepo

type QueryRepo interface {
	//Get should return the User whose Id equals id.
	//
	//An error should be returned if the User does not exist or there was an error
	//attempting to load the User.
	Get(ctx context.Context, id data.Id) (*User, error)

	//GetEmail should return the User whose Email equals email.
	//
	//An error should be returned if the User does not exist or there was an error
	//attempting to load the User.
	GetEmail(ctx context.Context, email string) (*User, error)

	//List should return all Users in the application.
	//They should be sorted by their lexicographic Email order.
	List(ctx context.Context) ([]*User, error)
}

QueryRepo provides methods for retrieving Users.

type Repo

type Repo interface {
	//QueryRepo is promoted here to indicate a Repo contains all query methods.
	QueryRepo

	//Add should add u to the underlying storage repository.
	Add(ctx context.Context, u User) error

	//Set should update all stored fields of u in the underlying storage repository.
	//The update should use u.Id for determining which entity to update.
	Set(ctx context.Context, u User) error
}

Repo provides method for creating and updating Users as well as promotes the QueryRepo interface.

type User

type User struct {
	//Id is the User's id.
	Id data.Id

	//Email is the User's email.
	//It must be unique across all users of the application.
	Email string

	//CreatedAt is the time at which this User was first created.
	CreatedAt time.Time

	//UpdatedAt is the most recent time this User was updated.
	UpdatedAt time.Time

	//Enabled is aboolean value indicating whether or not this User is enabled
	//and is allowed to use the application.
	Enabled bool

	//ClientIds is a slice of Ids that represent all of the Clients that this User
	//has access to.
	ClientIds []data.Id
}

User is a domain type that represents a user of the application.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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