attachment

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: May 16, 2024 License: Apache-2.0, BSD-2-Clause, BSD-3-Clause, + 2 more Imports: 3 Imported by: 0

Documentation

Overview

Package attachment provides a internal implementation of tRPC client/server attachment.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ClientRequestAttachment

func ClientRequestAttachment(msg codec.Msg) (io.Reader, bool)

ClientRequestAttachment returns client's Request Attachment from msg.

func ServerResponseAttachment

func ServerResponseAttachment(msg codec.Msg) (io.Reader, bool)

ServerResponseAttachment returns server's Response Attachment from msg.

func SetClientResponseAttachment

func SetClientResponseAttachment(msg codec.Msg, attachment []byte)

SetClientResponseAttachment sets client's Response attachment to msg. If the message does not contain client.Attachment, which means that the user has explicitly ignored the att returned by the server. For performance reasons, there is no need to set the response attachment into msg.

func SetServerRequestAttachment

func SetServerRequestAttachment(m codec.Msg, attachment []byte)

SetServerRequestAttachment sets server's Request Attachment to msg.

Types

type Attachment

type Attachment struct {
	Request  io.Reader
	Response io.Reader
}

Attachment stores the attachment in tRPC requests/responses.

type ClientAttachmentKey

type ClientAttachmentKey struct{}

ClientAttachmentKey is the key of client's Attachment.

type NoopAttachment

type NoopAttachment struct{}

NoopAttachment is an empty attachment.

func (NoopAttachment) Read

func (a NoopAttachment) Read(_ []byte) (n int, err error)

Read implements the io.Reader interface, which always returns (0, io.EOF)

type ServerAttachmentKey

type ServerAttachmentKey struct{}

ServerAttachmentKey is the key of server's Attachment.

Jump to

Keyboard shortcuts

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