crud

package
v3.9.1 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2020 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrServiceIsRequired occurs when underlying service is not provided
	ErrServiceIsRequired = errors.New("service is required")

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

	// ErrInvalid occurs when invalid action is requested
	ErrInvalid = errors.New("invalid")

	// ErrUnauthorized occurs when authentication not provided
	ErrUnauthorized = errors.New("authentication required")

	// ErrForbidden occurs when action is forbidden
	ErrForbidden = errors.New("forbidden")

	// ErrInternal occurs when unhandled behavior occurs
	ErrInternal = errors.New("internal server error")
)

Functions

This section is empty.

Types

type App

type App interface {
	Handler() http.Handler
	Swagger() (swagger.Configuration, error)
}

App of package

func New

func New(config Config, service Service) (App, error)

New creates new App from Config

type Config

type Config struct {
	// contains filtered or unexported fields
}

Config of package

func Flags

func Flags(fs *flag.FlagSet, prefix string) Config

Flags adds flags for configuring package

type Error added in v3.5.0

type Error struct {
	Field string `json:"field"`
	Label string `json:"label"`
}

Error describes a crud error

func NewError added in v3.5.0

func NewError(field, label string) Error

NewError creates a new error

type Service added in v3.4.0

type Service interface {
	Unmarshal(data []byte) (interface{}, error)
	Check(ctx context.Context, old, new interface{}) []Error
	List(ctx context.Context, page, pageSize uint, sortKey string, sortDesc bool, filters map[string][]string) ([]interface{}, uint, error)
	Get(ctx context.Context, ID uint64) (interface{}, error)
	Create(ctx context.Context, o interface{}) (interface{}, error)
	Update(ctx context.Context, o interface{}) (interface{}, error)
	Delete(ctx context.Context, o interface{}) error
}

Service retrieves item

Jump to

Keyboard shortcuts

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