apiinterface

package
v0.45.0 Latest Latest
Warning

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

Go to latest
Published: May 2, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	InternalError     = &PersesError{message: "internal server error"}
	NotFoundError     = &PersesError{message: "document not found"}
	ConflictError     = &PersesError{message: "document already exists"}
	BadRequestError   = &PersesError{message: "bad request"}
	UnauthorizedError = &PersesError{message: "unauthorized"}
	ForbiddenError    = &PersesError{message: "forbidden access"}
)
View Source
var (
	EmptyCtx = &context{
		username: "",
	}
)

Functions

func HandleBadRequestError added in v0.44.0

func HandleBadRequestError(msg string) error

func HandleError added in v0.44.0

func HandleError(err error) error

HandleError is translating the given error to the echo.HTTPError

func HandleForbiddenError added in v0.44.0

func HandleForbiddenError(msg string) error

func HandleNotFoundError added in v0.44.0

func HandleNotFoundError(msg string) error

func HandleUnauthorizedError added in v0.44.0

func HandleUnauthorizedError(msg string) error

Types

type Parameters

type Parameters struct {
	Project string
	Name    string
}

type PersesContext

type PersesContext interface {
	GetUsername() string
}

func NewPersesContext

func NewPersesContext(ctx echo.Context) PersesContext

type PersesError added in v0.44.0

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

func (*PersesError) Error added in v0.44.0

func (e *PersesError) Error() string

type Service

type Service[T api.Entity, K api.Entity, V databaseModel.Query] interface {
	Create(ctx PersesContext, entity T) (K, error)
	Update(ctx PersesContext, entity T, parameters Parameters) (K, error)
	Delete(ctx PersesContext, parameters Parameters) error
	Get(ctx PersesContext, parameters Parameters) (K, error)
	List(ctx PersesContext, q V, parameters Parameters) ([]K, error)
}

Jump to

Keyboard shortcuts

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