hookutil

package
v0.10.3-0...-f06509b Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	OpTypeKey          = "op_type"
	DatabaseKey        = "database"
	UsernameKey        = "username"
	RequestDataSizeKey = "request_data_size"
	ResultDataSizeKey  = "result_data_size"
	RelatedDataSizeKey = "related_data_size"
	SuccessCntKey      = "success_cnt"
	FailCntKey         = "fail_cnt"
	RelatedCntKey      = "related_cnt"
	NodeIDKey          = "id"

	OpTypeInsert       = "insert"
	OpTypeDelete       = "delete"
	OpTypeUpsert       = "upsert"
	OpTypeQuery        = "query"
	OpTypeSearch       = "search"
	OpTypeHybridSearch = "hybrid_search"
	OpTypeNodeID       = "node_id"
)
View Source
var (
	Hoo       hook.Hook
	Extension hook.Extension
)

Functions

func InitOnceHook

func InitOnceHook()

Types

type DefaultExtension

type DefaultExtension struct{}

func (DefaultExtension) Report

func (d DefaultExtension) Report(info any) int

type DefaultHook

type DefaultHook struct{}

func (DefaultHook) After

func (d DefaultHook) After(ctx context.Context, result interface{}, err error, fullMethod string) error

func (DefaultHook) Before

func (d DefaultHook) Before(ctx context.Context, req interface{}, fullMethod string) (context.Context, error)

func (DefaultHook) Init

func (d DefaultHook) Init(params map[string]string) error

func (DefaultHook) Mock

func (d DefaultHook) Mock(ctx context.Context, req interface{}, fullMethod string) (bool, interface{}, error)

func (DefaultHook) Release

func (d DefaultHook) Release()

func (DefaultHook) VerifyAPIKey

func (d DefaultHook) VerifyAPIKey(key string) (string, error)

type MockAPIHook

type MockAPIHook struct {
	DefaultHook
	MockErr error
	User    string
}

MockAPIHook is a mock hook for api key verification, ONLY FOR TEST

func (MockAPIHook) VerifyAPIKey

func (m MockAPIHook) VerifyAPIKey(apiKey string) (string, error)

Jump to

Keyboard shortcuts

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