grpc

package
v1.20.0 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2026 License: MIT Imports: 43 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewCoverage added in v1.20.0

func NewCoverage(path string, r *report.Report) (*oas.Coverage, error)

NewCoverage counts the steps of r that called each method the .proto file at path declares, as proto.files names the file. The file is parsed on its own, without its imports, as its services and methods are all that is counted. A .proto file declares no statuses its methods end with, so that its coverage is told by methods alone.

func Params added in v1.20.0

func Params() []string

Params returns the keys the grpc action takes in with: those of Req, and proto, which it reads apart from Req.

func Request added in v1.18.0

func Request(data map[string]any, opts ...Option) (map[string]any, error)

func Serve

func Serve()

Types

type Action

type Action struct {
	// contains filtered or unexported fields
}

func (*Action) Run

func (a *Action) Run(with map[string]any) (map[string]any, error)

type Callback added in v1.18.0

type Callback struct {
	// contains filtered or unexported fields
}

type Option added in v1.18.0

type Option func(*Callback)

func WithAfter added in v1.18.0

func WithAfter(f func(res *Res)) Option

func WithBefore added in v1.18.0

func WithBefore(f func(ctx context.Context, service, method string)) Option

type Req added in v1.18.0

type Req struct {
	Addr     string            `map:"addr" validate:"required"`
	Service  string            `map:"service" validate:"required"`
	Method   string            `map:"method" validate:"required"`
	Body     string            `map:"body"`
	Timeout  string            `map:"timeout"`
	TLS      bool              `map:"tls"`
	Insecure bool              `map:"insecure"`
	CertFile string            `map:"cert_file"`
	KeyFile  string            `map:"key_file"`
	CAFile   string            `map:"ca_file"`
	Metadata map[string]string `map:"metadata"`
	// contains filtered or unexported fields
}

func NewReq added in v1.18.0

func NewReq() *Req

func (*Req) Do added in v1.18.0

func (r *Req) Do() (re *Result, er error)

type Res added in v1.18.0

type Res struct {
	Body          string            `map:"body"`
	StatusCode    string            `map:"status_code"`
	StatusMessage string            `map:"status_message"`
	Metadata      map[string]string `map:"metadata"`
	// contains filtered or unexported fields
}

type Result added in v1.18.0

type Result struct {
	Req    Req           `map:"req"`
	Res    Res           `map:"res"`
	RT     time.Duration `map:"rt"`
	Status int           `map:"status"`
}

Directories

Path Synopsis
pb

Jump to

Keyboard shortcuts

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