rkmidpanic

package
v2.2.3 Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2022 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package rkmidpanic provide options

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BeforeCtx

type BeforeCtx struct {
	Input struct {
		Event        rkquery.Event
		Logger       *zap.Logger
		PanicHandler func(resp rkerror.ErrorInterface)
	}
	Output struct {
		DeferFunc func()
	}
}

BeforeCtx context for Before() function

func NewBeforeCtx

func NewBeforeCtx() *BeforeCtx

NewBeforeCtx create new BeforeCtx with fields initialized

type Option

type Option func(*optionSet)

Option is for middleware while creating

func WithEntryNameAndType

func WithEntryNameAndType(entryName, entryType string) Option

WithEntryNameAndType Provide entry name and entry type.

func WithMockOptionSet

func WithMockOptionSet(mock OptionSetInterface) Option

WithMockOptionSet provide mock OptionSetInterface

type OptionSetInterface

type OptionSetInterface interface {
	GetEntryName() string

	GetEntryType() string

	Before(*BeforeCtx)

	BeforeCtx(event rkquery.Event, logger *zap.Logger, handler handlerFunc) *BeforeCtx
}

OptionSetInterface mainly for testing purpose

func NewOptionSet

func NewOptionSet(opts ...Option) OptionSetInterface

NewOptionSet Create new optionSet with options.

func NewOptionSetMock

func NewOptionSetMock(before *BeforeCtx) OptionSetInterface

NewOptionSetMock for testing purpose

Jump to

Keyboard shortcuts

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