directives

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2026 License: Apache-2.0 Imports: 20 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrValueIsNil       = errors.New("value is nil")
	ErrValueIsEmpty     = errors.New("value is empty")
	ErrValueOutOfRange  = errors.New("value is out of range")
	ErrValueIsNotNumber = errors.New("value is not a number")
)

Functions

func Auth

func Auth(ctx context.Context, obj any, next graphql.Resolver) (any, error)

Auth directive checks that user is authenticated

func CacheData added in v0.3.0

func CacheData(ctx context.Context, obj any, next graphql.Resolver, ttl int, keyTmp *string, fields []string) (res any, err error)

CacheData is a GraphQL directive that caches the result of a field/method for a specified time to live (ttl) in seconds.

func HasPermissions

func HasPermissions[T user.Model, A account.Model](ctx context.Context, obj any, next graphql.Resolver, perms []string) (any, error)

HasPermissions for this user to the particular permission of the object

func SkipNoPermissions

func SkipNoPermissions(ctx context.Context, obj any, next graphql.Resolver, perms []string) (any, error)

SkipNoPermissions directive to skip resolver if no permissions

func ValidateLength added in v0.5.0

func ValidateLength(ctx context.Context, obj any, next graphql.Resolver, min, max int, trim, ornil bool) (res any, err error)

func ValidateNotEmpty added in v0.5.0

func ValidateNotEmpty(ctx context.Context, obj any, next graphql.Resolver, trim, ornil bool) (res any, err error)

func ValidateRange added in v0.5.0

func ValidateRange(ctx context.Context, obj any, next graphql.Resolver, min, max float64, ornil bool) (res any, err error)

func ValidateRegex added in v0.5.0

func ValidateRegex(ctx context.Context, obj any, next graphql.Resolver, pattern string, trim, ornil bool) (res any, err error)

Types

type CacheDecodable added in v0.3.6

type CacheDecodable interface {
	DecodableCacheValue([]byte) error
}

type CacheEncodable added in v0.3.6

type CacheEncodable interface {
	EncodableCacheValue() ([]byte, error)
}

Jump to

Keyboard shortcuts

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