service

package
v2.5.3 Latest Latest
Warning

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

Go to latest
Published: May 23, 2020 License: MIT Imports: 8 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrInvalid occurs when checks fails
	ErrInvalid = errors.New("invalid")

	// ErrUnauthorized occurs when user is not authorized
	ErrUnauthorized = errors.New("unauthorized")

	// ErrForbidden occurs when user if forbideen
	ErrForbidden = errors.New("forbidden")

	// ErrNotFound occurs when somehint is not found
	ErrNotFound = errors.New("not found")

	// ErrInternalError occurs when shit happens
	ErrInternalError = errors.New("internal error")
)

Functions

func ConcatError added in v2.5.0

func ConcatError(errs []error) error

ConcatError concat errors to a single string

func WrapForbidden added in v2.5.0

func WrapForbidden(err error) error

WrapForbidden wraps given error with forbidden err

func WrapInternal added in v2.5.0

func WrapInternal(err error) error

WrapInternal wraps given error with internal err

func WrapInvalid added in v2.5.0

func WrapInvalid(err error) error

WrapInvalid wraps given error with invalid err

func WrapNotFound added in v2.5.0

func WrapNotFound(err error) error

WrapNotFound wraps given error with not found err

func WrapUnauthorized added in v2.5.0

func WrapUnauthorized(err error) error

WrapUnauthorized wraps given error with unauthorized err

Types

type App

type App interface {
	Check(ctx context.Context, old, new model.User) error
	List(ctx context.Context, page, pageSize uint, sortKey string, sortDesc bool, filters map[string][]string) ([]model.User, uint, error)
	Get(ctx context.Context, ID uint64) (model.User, error)
	Create(ctx context.Context, o model.User) (model.User, error)
	Update(ctx context.Context, o model.User) (model.User, error)
	Delete(ctx context.Context, o model.User) error

	CheckRights(ctx context.Context, id uint64) error
}

App of package

func New

func New(store store.UserStorage, auth auth.Provider) App

New creates new App from Config

Jump to

Keyboard shortcuts

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