hooks

package
v0.0.0-...-43028c6 Latest Latest
Warning

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

Go to latest
Published: Dec 29, 2022 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AlterItems

func AlterItems(handler AlterItemHandler) feathers.Hook

AlterItems alters the items (either data or result) different to the original feathers-hook returning nil will remove the item from items Returning error in handler will immediatly cancel execution and return error

func CheckContext

func CheckContext(ctx *feathers.Context, hookName string, allowedTypes []feathers.HookType, allowedMethods []feathers.RestMethod) error

CheckContext checks the context for required properties. returns error if requirement not set.

func CheckPermissions

func CheckPermissions(requiredPermissions ...string) feathers.Hook

func Combine

func Combine(ctx *feathers.Context, chain ...feathers.Hook) error

func Disallow

func Disallow(providers ...string) feathers.Hook

*

Disallow throws error if user is any of these providers
If no providers are passed route is completely disabled

func Discard

func Discard(fields ...string) feathers.Hook

func DiscardQuery

func DiscardQuery(fields ...string) feathers.Hook

func Every

func Every(checks ...feathers.BoolHook) feathers.BoolHook

func GetItems

func GetItems(ctx *feathers.Context) interface{}

func GetItemsNormalized

func GetItemsNormalized(ctx *feathers.Context) ([]map[string]interface{}, bool)

func Iff

func Iff(pred feathers.BoolHook, trueHooks ...feathers.Hook) feathers.Hook

func IffElse

func IffElse(pred feathers.BoolHook, trueHooks []feathers.Hook, falseHooks []feathers.Hook) feathers.Hook

func IffNot

func IffNot(pred feathers.BoolHook, trueHooks ...feathers.Hook) feathers.Hook

func IsNot

func IsNot(check feathers.BoolHook) feathers.BoolHook

func IsProvider

func IsProvider(provider string) feathers.BoolHook

IsProvider BoolHook checks if is provider of specific type

func Join

func Join(joinConfig map[string]JoinOperator) feathers.Hook

func Keep

func Keep(keep ...string) feathers.Hook

func KeepQuery

func KeepQuery(keep ...string) feathers.Hook

func LowerCase

func LowerCase(fields ...string) feathers.Hook

func NormalizeSlice

func NormalizeSlice(data interface{}) (interface{}, bool)

func PreventChanges

func PreventChanges(retError bool, fields ...string) feathers.Hook

func ReplaceItems

func ReplaceItems(ctx *feathers.Context, data interface{})

func ReplaceItemsNormalized

func ReplaceItemsNormalized(ctx *feathers.Context, data interface{}, normalized bool)

func Required

func Required(fields ...string) feathers.Hook

Required checks if all passed fields are set

func RequiredQuery

func RequiredQuery(fields ...string) feathers.Hook

Required checks if all passed fields are set

func SetNow

func SetNow(fields ...string) feathers.Hook

SetNow sets fields to Now value (Time.Now()).

func Some

func Some(checks ...feathers.BoolHook) feathers.BoolHook

func UnormalizeSlice

func UnormalizeSlice(data interface{}, normalized bool) interface{}

Types

type AlterItemHandler

type AlterItemHandler = func(item interface{}, ctx *feathers.Context) (interface{}, error)

type JoinOperator

type JoinOperator = func(entity map[string]interface{}, ctx *feathers.Context) error

Jump to

Keyboard shortcuts

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