gin_utils

package
v0.3.7 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2024 License: Apache-2.0 Imports: 3 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CRUDMiddleware

type CRUDMiddleware struct {
	Create []gin.HandlerFunc
	Read   []gin.HandlerFunc
	Update []gin.HandlerFunc
	Delete []gin.HandlerFunc
}

CRUDMiddleware contains all the given CRUD middlewares

func NewCRUDMiddleware

func NewCRUDMiddleware() *CRUDMiddleware

NewCRUDMiddleware constructor of CRUDMiddleware

func ToCRUDMiddlewares

func ToCRUDMiddlewares(mm ...*TorpedoMiddleware) *CRUDMiddleware

ToCRUDMiddlewares given a list of TorpedoMiddleware creates and returns the CRUDMiddleware instance

func (*CRUDMiddleware) HasCreate

func (m *CRUDMiddleware) HasCreate() bool

HasCreate check if the Create middleware list is empty or not

func (*CRUDMiddleware) HasDelete

func (m *CRUDMiddleware) HasDelete() bool

HasDelete check if the Delete middleware list is empty or not

func (*CRUDMiddleware) HasRead

func (m *CRUDMiddleware) HasRead() bool

HasRead check if the Read middleware list is empty or not

func (*CRUDMiddleware) HasUpdate

func (m *CRUDMiddleware) HasUpdate() bool

HasUpdate check if the Update middleware list is empty or not

type CRUDQMiddleware added in v0.3.5

type CRUDQMiddleware struct {
	CRUDMiddleware
	Query []gin.HandlerFunc
}

CRUDQMiddleware extends the CRUDMiddleware to support the Query middleware as well

func NewCRUDQMiddleware added in v0.3.5

func NewCRUDQMiddleware() *CRUDQMiddleware

NewCRUDQMiddleware constructor of CRUDQMiddleware

func ToCRUDQMiddlewares added in v0.3.5

func ToCRUDQMiddlewares(mm ...*TorpedoMiddleware) *CRUDQMiddleware

ToCRUDQMiddlewares given a list of TorpedoMiddleware creates and returns the CRUDQMiddleware instance

func (*CRUDQMiddleware) HasQuery added in v0.3.5

func (m *CRUDQMiddleware) HasQuery() bool

HasQuery check if the Query middleware list is empty or not

type MiddlewareTypeEnum

type MiddlewareTypeEnum enum.Type
const (
	Undefined MiddlewareTypeEnum = iota

	Create
	Read
	Update
	Delete
	Query
)

func NewMiddlewareTypeEnumFromString

func NewMiddlewareTypeEnumFromString(s string) MiddlewareTypeEnum

func (MiddlewareTypeEnum) String

func (c MiddlewareTypeEnum) String() string

func (MiddlewareTypeEnum) ToInt

func (c MiddlewareTypeEnum) ToInt() int

func (MiddlewareTypeEnum) Value

func (c MiddlewareTypeEnum) Value() enum.Type

type TorpedoMiddleware

type TorpedoMiddleware struct {
	Type MiddlewareTypeEnum
	Fn   gin.HandlerFunc
}

TorpedoMiddleware struct to create middlewares via parameter

func WithCreateMiddleware

func WithCreateMiddleware(fn gin.HandlerFunc) *TorpedoMiddleware

WithCreateMiddleware attach the given middleware to the Create request

func WithDeleteMiddleware

func WithDeleteMiddleware(fn gin.HandlerFunc) *TorpedoMiddleware

WithDeleteMiddleware attach the given middleware to the Delete request

func WithQueryMiddleware added in v0.3.5

func WithQueryMiddleware(fn gin.HandlerFunc) *TorpedoMiddleware

WithQueryMiddleware attach the given middleware to the Query request

func WithReadMiddleware

func WithReadMiddleware(fn gin.HandlerFunc) *TorpedoMiddleware

WithReadMiddleware attach the given middleware to the Read request

func WithUpdateMiddleware

func WithUpdateMiddleware(fn gin.HandlerFunc) *TorpedoMiddleware

WithUpdateMiddleware attach the given middleware to the Update request

Jump to

Keyboard shortcuts

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