model

package
v3.6.1 Latest Latest
Warning

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

Go to latest
Published: Jan 1, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrForbidden          = errors.New("forbidden access")
	ErrUnknownUser        = errors.New("unknown user")
	ErrUnknownLink        = errors.New("unknown link")
	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 Authentication added in v3.1.0

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

type Authorization

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

type Storage

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

type User

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

func NewUser

func NewUser(name string) User

func ReadUser

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

Jump to

Keyboard shortcuts

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