spike

package
v0.44.0 Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2023 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	SpikeMockDetailProxyContext = func() (pctx inject.ProxyContext) {
		pctx = spikeMockCommonProxyContext
		pctx.MethodName = "Detail"
		return
	}()
	SpikeMockGrabProxyContext = func() (pctx inject.ProxyContext) {
		pctx = spikeMockCommonProxyContext
		pctx.MethodName = "Grab"
		return
	}()
)

Functions

func RegisterProxyMethod

func RegisterProxyMethod(pctx inject.ProxyContext, cf inject.CtxFunc)

Types

type Content

type Content struct {
}

type Spike

type Spike interface {
	// 获取详情
	Detail() (Content, error)
	// 抢
	Grab(ctx context.Context) (uint, error)
}

Spike 秒杀

func NewSpike

func NewSpike() Spike

type SpikeMock

type SpikeMock struct {
	DetailFunc func() (Content, error)

	GrabFunc func(ctx context.Context) (uint, error)
}

func (*SpikeMock) Detail

func (mockRecv *SpikeMock) Detail() (Content, error)

func (*SpikeMock) Grab

func (mockRecv *SpikeMock) Grab(ctx context.Context) (uint, error)

Jump to

Keyboard shortcuts

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