handler

package
v0.0.0-...-6b6719a Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrRecordNotFound = errors.New("no record found")
	ErrDuplicate      = errors.New("duplicate key value")
	ErrConflict       = errors.New("data conflict")
	ErrDatabase       = errors.New("database error")
)

Functions

This section is empty.

Types

type Handler

type Handler[T, TShort, TInput any] struct {
	// contains filtered or unexported fields
}

func (Handler[T, TShort, TInput]) Create

func (h Handler[T, TShort, TInput]) Create(parent T, m TInput) error

func (Handler[T, TShort, TInput]) Delete

func (h Handler[T, TShort, TInput]) Delete(query T, force bool) error

func (Handler[T, TShort, TInput]) GetMany

func (h Handler[T, TShort, TInput]) GetMany(page, size int, order string, filters map[string]any) ([]TShort, error)

func (Handler[T, TShort, TInput]) GetOne

func (h Handler[T, TShort, TInput]) GetOne(query T) (T, error)

func (Handler[T, TShort, TInput]) Update

func (h Handler[T, TShort, TInput]) Update(selector T, m TInput) error

type IHandler

type IHandler[T, TShort, TInput any] interface {
	GetMany(page, size int, order string, filters map[string]any) ([]TShort, error)
	Create(parent T, m TInput) error
	GetOne(selector T) (T, error)
	Update(selector T, m TInput) error
	Delete(selector T, force bool) error
}

func NewHandler

func NewHandler[T, TShort, TInput any](merge func(T, TInput) T) IHandler[T, TShort, TInput]

type State

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

func NewState

func NewState() *State

func (*State) Healthy

func (s *State) Healthy()

func (*State) HealthyHandler

func (s *State) HealthyHandler() gin.HandlerFunc

@Summary Check liveness @ID healthy @Tags probes @Success 200 {string} OK @Failure 503 {string} NOT OK @Router /-/healthy [get]

func (*State) NotHealthy

func (s *State) NotHealthy()

func (*State) NotReady

func (s *State) NotReady()

func (*State) Ready

func (s *State) Ready()

func (*State) ReadyHandler

func (s *State) ReadyHandler() gin.HandlerFunc

@Summary Check readiness @ID ready @Tags probes @Success 200 {string} OK @Failure 503 {string} NOT OK @Router /-/ready [get]

Jump to

Keyboard shortcuts

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