callinfo

package
Version: v1.8.0 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2019 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package callinfo stores custom values into the Context (related to the RPC source)

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GRPCCallInfo

func GRPCCallInfo(ctx context.Context) context.Context

GRPCCallInfo returns an augmented context with a CallInfo structure, only for gRPC contexts.

func HTMLFromContext

func HTMLFromContext(ctx context.Context) template.HTML

HTMLFromContext returns that value of HTML() from the context, or "" if we're not able to recover one

func MysqlCallInfo

func MysqlCallInfo(ctx context.Context, c *mysql.Conn) context.Context

MysqlCallInfo returns an augmented context with a CallInfo structure, only for Mysql contexts.

func NewContext

func NewContext(ctx context.Context, ci CallInfo) context.Context

NewContext adds the provided CallInfo to the context

Types

type CallInfo

type CallInfo interface {
	// RemoteAddr is the remote address information for this rpc call.
	RemoteAddr() string

	// Username is associated with this rpc call, if any.
	Username() string

	// Text is a text version of this connection, as specifically as possible.
	Text() string

	// HTML represents this rpc call connection in a web-friendly way.
	HTML() template.HTML
}

CallInfo is the extra data stored in the Context

func FromContext

func FromContext(ctx context.Context) (CallInfo, bool)

FromContext returns the CallInfo value stored in ctx, if any.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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