identity

package
v1.8.7 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNotFound is returned when a user being fetched does not exist.
	ErrNotFound = errors.New("user not found")

	// ErrAlreadyExists is returned when a new user record is being added already
	// exists.
	ErrAlreadyExists = errors.New("user already exists")
)

Functions

This section is empty.

Types

type Record

type Record struct {
	ID          *user.UserID
	View        *user.View
	IsStaffUser bool
	IsBanned    bool
	CreatedAt   time.Time
}

User is the highest order of a form of identity.

func (*Record) Validate

func (r *Record) Validate() error

Validate validates a Record

type Store

type Store interface {
	// Put creates a new user.
	Put(ctx context.Context, record *Record) error

	// GetByID fetches a user by its ID.
	GetByID(ctx context.Context, id *user.UserID) (*Record, error)

	// GetByView fetches a user by a view.
	GetByView(ctx context.Context, view *user.View) (*Record, error)
}

Store manages a user's identity.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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