model

package
v3.0.1 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2025 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrForbidden          = errors.New("forbidden access")
	ErrUnknownUser        = errors.New("unknown user")
	ErrMalformedContent   = errors.New("malformed content")
	ErrUnavailableService = errors.New("unavailable service")
	ErrInvalidCredentials = errors.New("invalid credentials")
)

Functions

func StoreUser

func StoreUser(ctx context.Context, user User) context.Context

Types

type Authorization

type Authorization interface {
	IsAuthorized(context.Context, User, string) bool
	OnForbidden(http.ResponseWriter, *http.Request, User, string)
}

type Identification

type Identification interface {
	GetUser(context.Context, *http.Request) (User, error)
	OnError(http.ResponseWriter, *http.Request, error)
}

type Storage

type Storage interface {
	Create(context.Context) (User, error)
	Delete(context.Context, User) error
}

type User

type User struct {
	Name string `json:"name"`
	ID   uint64 `json:"id"`
}

func NewUser

func NewUser(id uint64, name string) User

func ReadUser

func ReadUser(ctx context.Context) (output User)

func (User) IsZero

func (u User) IsZero() bool

Jump to

Keyboard shortcuts

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