Home / Type/ Context Type — gin Architecture

Context Type — gin Architecture

Architecture documentation for the Context type/interface in context.go from the gin codebase.

Entity Profile

Dependency Diagram

graph TD
  a6edd09e_61df_c12a_9204_92dab598fd91["Context"]
  c22deef8_5218_863f_341c_441bf58f550e["context.go"]
  a6edd09e_61df_c12a_9204_92dab598fd91 -->|defined in| c22deef8_5218_863f_341c_441bf58f550e
  style a6edd09e_61df_c12a_9204_92dab598fd91 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

context.go lines 61–97

type Context struct {
	writermem responseWriter
	Request   *http.Request
	Writer    ResponseWriter

	Params   Params
	handlers HandlersChain
	index    int8
	fullPath string

	engine       *Engine
	params       *Params
	skippedNodes *[]skippedNode

	// This mutex protects Keys map.
	mu sync.RWMutex

	// Keys is a key/value pair exclusively for the context of each request.
	Keys map[any]any

	// Errors is a list of errors attached to all the handlers/middlewares who used this context.
	Errors errorMsgs

	// Accepted defines a list of manually accepted formats for content negotiation.
	Accepted []string

	// queryCache caches the query result from c.Request.URL.Query().
	queryCache url.Values

	// formCache caches c.Request.PostForm, which contains the parsed form data from POST, PATCH,
	// or PUT body parameters.
	formCache url.Values

	// SameSite allows a server to define a cookie attribute making it impossible for
	// the browser to send this cookie along with cross-site requests.
	sameSite http.SameSite
}

Defined In

Frequently Asked Questions

What is the Context type?
Context is a type/interface in the gin codebase, defined in context.go.
Where is Context defined?
Context is defined in context.go at line 61.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free