executor

package
v0.6.7 Latest Latest
Warning

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

Go to latest
Published: Jan 2, 2026 License: MIT Imports: 22 Imported by: 0

Documentation

Overview

Package executor provides transport implementations for HTTP, gRPC, TCP, and GraphQL.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GRPCTransport

func GRPCTransport(ctx context.Context, req *domain.Request) (*domain.Response, error)

GRPCTransport is the transport function for gRPC requests.

func TCPTransport

func TCPTransport(ctx context.Context, req *domain.Request) (*domain.Response, error)

TCPTransport is the transport function for TCP requests.

Types

type Factory

type Factory struct {
	Client HTTPClient
}

Factory creates transport functions for different protocols.

func NewFactory

func NewFactory(client HTTPClient) *Factory

NewFactory creates a new executor factory with the given HTTP client.

func (*Factory) Create

func (f *Factory) Create(transport string) (TransportFunc, error)

Create returns the appropriate transport function for the given transport type. The returned function is wrapped with timing middleware.

type HTTPClient

type HTTPClient interface {
	Do(req *http.Request) (*http.Response, error)
}

HTTPClient is an interface for a client that can send HTTP requests.

type TransportFunc

type TransportFunc func(ctx context.Context, req *domain.Request) (*domain.Response, error)

TransportFunc is the functional signature for all transport implementations.

func GraphQLTransport

func GraphQLTransport(client HTTPClient) TransportFunc

GraphQLTransport returns a transport function for GraphQL requests.

func HTTPTransport

func HTTPTransport(client HTTPClient) TransportFunc

HTTPTransport returns a transport function for HTTP requests.

func WithTiming

func WithTiming(next TransportFunc) TransportFunc

WithTiming wraps a transport function to measure execution duration.

Jump to

Keyboard shortcuts

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