mock

package
v0.0.0-...-f85d451 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

README

mock

用于提供mock能力。

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type IMatcher

type IMatcher interface {
	Matcher() mock.Matcher
}

IMatcher 由所有config.mock.matchers.xxx模块实现,供Matchers模块注册资源使用 设计考量:不一定每个模块自身都会实现mock.Matcher,因此,实现IMatcher更具通用性

type Matcher

type Matcher struct {
	Name      string          `json:"name"`
	ConfigRaw json.RawMessage `json:"config" caddy:"namespace=config.mock.matchers inline_key=matcher"`
}

Client define a http client config

type Matchers

type Matchers struct {
	Matchers []Matcher `json:"matchers,omitempty"`
}

Clients 定义HTTP客户端,便于多个包共享连接池

func (Matchers) CaddyModule

func (c Matchers) CaddyModule() caddy.ModuleInfo

CaddyModule returns the Caddy module information.

func (Matchers) ID

func (Matchers) ID() string

ID 模块ID

func (Matchers) Produces

func (c Matchers) Produces() []string

Produces 记录资源和模块生产关系

func (*Matchers) Provision

func (c *Matchers) Provision(ctx caddy.Context) error

Provision 实现Provisioner

func (Matchers) Validate

func (c Matchers) Validate() error

Validate 实现Validator

type Mock

type Mock struct {
	*Matchers
}

Mock define a list of http.handlers configration, which can be referenced later by name

func (Mock) CaddyModule

func (Mock) CaddyModule() caddy.ModuleInfo

CaddyModule returns the Caddy module information.

func (*Mock) Provision

func (c *Mock) Provision(ctx caddy.Context) error

Provision 实现Provisioner

func (Mock) Validate

func (c Mock) Validate() error

Validate 实现Validator

Jump to

Keyboard shortcuts

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