query

package
v0.5.2 Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Err_ProvidedCachingTypeIsNil = errors.New("provided caching type is nil")

Functions

This section is empty.

Types

type CachingType

type CachingType string
const (
	RedisCaching  CachingType = "redis"
	MemoryCaching CachingType = "memory"
)

type Options

type Options struct {
	Keys           []string
	CacheTime      time.Duration
	RevalidateTime time.Duration
	Retries        uint
	CacheType      CachingType
}

type QueryClient

type QueryClient interface {
	Query(
		ctx context.Context,
		queryFunction QueryFn,
		result interface{},
		options *Options,
	) error
	Mutate(
		ctx context.Context,
		mutationFunction QueryFn,
		result interface{},
		options *Options,
	) error
}

func NewQueryClient

func NewQueryClient(
	memCache *cache.Cache,
	redisCache *redis.Client,
) QueryClient

type QueryFn

type QueryFn func(ctx context.Context) (interface{}, error)

Jump to

Keyboard shortcuts

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