route

package
v1.5.1 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2026 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Forward

func Forward[Req, Cmd, Result, Resp any](
	ctx context.Context,
	req *Req,
	toCmd func(*Req) *Cmd,
	call func(context.Context, *Cmd) (*Result, error),
	toResp func(*Result) *Resp,
) (*Resp, error)

Forward converts req via toCmd, invokes call, and converts the result via toResp. Errors from call propagate unchanged so gRPC status-code translation in interceptors works.

func (s *contractService) GetContract(ctx context.Context, req *proto.GetContractRequest) (*proto.Contract, error) {
    return route.Forward(ctx, req,
        s.converter.GetContractRequestToCommand,
        s.contractManagement.GetContract,
        s.converter.ContractToProto)
}

Use hand-written handlers for methods that don't fit the strict convert→call→convert shape.

Types

This section is empty.

Jump to

Keyboard shortcuts

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