crud

package
v3.28.0 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2020 License: MIT Imports: 15 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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

func GetConfiguredFlags added in v3.13.0

func GetConfiguredFlags(path, name string) func(*flag.FlagSet, string) Config

GetConfiguredFlags adds flags for configuring package

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

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

func (Error) Error added in v3.14.0

func (e Error) Error() string

Error format error to string

type Service added in v3.4.0

type Service interface {
	Unmarshal(data []byte, contentType string) (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