cx

package
v0.0.15 Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2022 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Get

func Get(ctx context.Context, key string) string

func GetQuery

func GetQuery(ctx context.Context, keys ...string) string

Types

type Context

type Context struct {
	context.Context
}

func FromContext

func FromContext(cs ...context.Context) *Context

func FromServer

func FromServer(ctx context.Context, w http.ResponseWriter, r *http.Request, p map[string]string) *Context

func (*Context) Append

func (c *Context) Append(kv ...string)

func (*Context) Get

func (c *Context) Get(key string) string

func (*Context) GetAll

func (c *Context) GetAll() MD

func (*Context) GetQuery

func (c *Context) GetQuery(keys ...string) string

func (*Context) GetRaw

func (c *Context) GetRaw(key string) []string

func (*Context) GetServer

func (c *Context) GetServer() *Server

func (*Context) Set

func (c *Context) Set(kv ...string)

type MD

type MD = metadata.MD

type Server

type Server struct {
	W http.ResponseWriter
	R *http.Request
	P url.Values
}

func GetServer

func GetServer(ctx context.Context) *Server

func (*Server) Body

func (s *Server) Body() []byte

func (*Server) Header

func (s *Server) Header() http.Header

func (*Server) Param

func (s *Server) Param() url.Values

func (*Server) Query

func (s *Server) Query() url.Values

func (*Server) Write

func (s *Server) Write(code int, content string, kv ...string)

func (*Server) WriteJSON

func (s *Server) WriteJSON(code int, data interface{}, kv ...string)

Jump to

Keyboard shortcuts

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