https://github.com/gorilla/context

context go golang gorilla gorilla-web-toolkit

Last synced: about 1 month ago

Repository metadata:

Package gorilla/context is a golang registry for global request variables.


Owner metadata:


Committers metadata

Last synced: about 1 month ago

Total Commits: 46
Total Committers: 12
Avg Commits per committer: 3.833
Development Distribution Score (DDS): 0.739

Commits in past year: 0
Committers in past year: 0
Avg Commits per committer in past year: 0.0
Development Distribution Score (DDS) in past year: 0.0

Name Email Commits
Kamil Kisiel k****l@k****t 12
Matt Silverlock m****t@e****t 7
Pieter Joost van de Sande pj@b****t 7
Tyler Bunnell t****l@g****m 5
Corey Daley c****y@r****m 4
rodrigo moraes r****s@g****m 3
Adam Mckaig a****g@g****m 2
Dmitry Bochkarev d****v@g****m 2
Alexandr Morozov l****h@g****m 1
Andrews Medina a****a@g****m 1
areski a****i@g****m 1
yuokada c****t@g****m 1

Issue and Pull Request metadata

Last synced: about 1 month ago


Package metadata

go: github.com/gorilla/context

Package context stores values shared during a request lifetime. Note: gorilla/context, having been born well before `context.Context` existed, does not play well > with the shallow copying of the request that [`http.Request.WithContext`](https://golang.org/pkg/net/http/#Request.WithContext) (added to net/http Go 1.7 onwards) performs. You should either use *just* gorilla/context, or moving forward, the new `http.Request.Context()`. For example, a router can set variables extracted from the URL and later application handlers can access those values, or it can be used to store sessions values to be saved at the end of a request. There are several others common uses. The idea was posted by Brad Fitzpatrick to the go-nuts mailing list: Here's the basic usage: first define the keys that you will need. The key type is interface{} so a key can be of any type that supports equality. Here we define a key using a custom int type to avoid name collisions: Then set a variable. Variables are bound to an http.Request object, so you need a request instance to set a value: The application can later access the variable using the same key you provided: And that's all about the basic usage. We discuss some other ideas below. Any type can be stored in the context. To enforce a given type, make the key private and wrap Get() and Set() to accept and return values of a specific type: Variables must be cleared at the end of a request, to remove all values that were stored. This can be done in an http.Handler, after a request was served. Just call Clear() passing the request: ...or use ClearHandler(), which conveniently wraps an http.Handler to clear variables at the end of a request lifetime. The Routers from the packages gorilla/mux and gorilla/pat call Clear() so if you are using either of them you don't need to clear the context manually.

  • Homepage: https://github.com/gorilla/context
  • Documentation: https://pkg.go.dev/github.com/gorilla/context#section-documentation
  • Licenses: BSD-3-Clause
  • Latest release: v1.1.2 (published about 1 year ago)
  • Last Synced: 2024-11-11T01:31:33.304Z (about 1 month ago)
  • Versions: 2
  • Dependent Packages: 4,065
  • Dependent Repositories: 46,896
  • Docker Downloads: 542,774,454
  • Rankings:
    • Dependent repos count: 0.025%
    • Dependent packages count: 0.044%
    • Docker downloads count: 0.345%
    • Average: 1.091%
    • Forks count: 2.279%
    • Stargazers count: 2.761%
go: github.com/Gorilla/context

Package context stores values shared during a request lifetime. Note: gorilla/context, having been born well before `context.Context` existed, does not play well > with the shallow copying of the request that [`http.Request.WithContext`](https://golang.org/pkg/net/http/#Request.WithContext) (added to net/http Go 1.7 onwards) performs. You should either use *just* gorilla/context, or moving forward, the new `http.Request.Context()`. For example, a router can set variables extracted from the URL and later application handlers can access those values, or it can be used to store sessions values to be saved at the end of a request. There are several others common uses. The idea was posted by Brad Fitzpatrick to the go-nuts mailing list: Here's the basic usage: first define the keys that you will need. The key type is interface{} so a key can be of any type that supports equality. Here we define a key using a custom int type to avoid name collisions: Then set a variable. Variables are bound to an http.Request object, so you need a request instance to set a value: The application can later access the variable using the same key you provided: And that's all about the basic usage. We discuss some other ideas below. Any type can be stored in the context. To enforce a given type, make the key private and wrap Get() and Set() to accept and return values of a specific type: Variables must be cleared at the end of a request, to remove all values that were stored. This can be done in an http.Handler, after a request was served. Just call Clear() passing the request: ...or use ClearHandler(), which conveniently wraps an http.Handler to clear variables at the end of a request lifetime. The Routers from the packages gorilla/mux and gorilla/pat call Clear() so if you are using either of them you don't need to clear the context manually.

  • Homepage: https://github.com/Gorilla/context
  • Documentation: https://pkg.go.dev/github.com/Gorilla/context#section-documentation
  • Licenses: BSD-3-Clause
  • Latest release: v1.1.2 (published about 1 year ago)
  • Last Synced: 2024-11-11T01:31:35.316Z (about 1 month ago)
  • Versions: 2
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Rankings:
    • Forks count: 1.431%
    • Stargazers count: 1.697%
    • Average: 4.868%
    • Dependent packages count: 6.999%
    • Dependent repos count: 9.346%
go: github.com/gorilla/Context

Package context stores values shared during a request lifetime. Note: gorilla/context, having been born well before `context.Context` existed, does not play well > with the shallow copying of the request that [`http.Request.WithContext`](https://golang.org/pkg/net/http/#Request.WithContext) (added to net/http Go 1.7 onwards) performs. You should either use *just* gorilla/context, or moving forward, the new `http.Request.Context()`. For example, a router can set variables extracted from the URL and later application handlers can access those values, or it can be used to store sessions values to be saved at the end of a request. There are several others common uses. The idea was posted by Brad Fitzpatrick to the go-nuts mailing list: Here's the basic usage: first define the keys that you will need. The key type is interface{} so a key can be of any type that supports equality. Here we define a key using a custom int type to avoid name collisions: Then set a variable. Variables are bound to an http.Request object, so you need a request instance to set a value: The application can later access the variable using the same key you provided: And that's all about the basic usage. We discuss some other ideas below. Any type can be stored in the context. To enforce a given type, make the key private and wrap Get() and Set() to accept and return values of a specific type: Variables must be cleared at the end of a request, to remove all values that were stored. This can be done in an http.Handler, after a request was served. Just call Clear() passing the request: ...or use ClearHandler(), which conveniently wraps an http.Handler to clear variables at the end of a request lifetime. The Routers from the packages gorilla/mux and gorilla/pat call Clear() so if you are using either of them you don't need to clear the context manually.

  • Homepage: https://github.com/gorilla/Context
  • Documentation: https://pkg.go.dev/github.com/gorilla/Context#section-documentation
  • Licenses: BSD-3-Clause
  • Latest release: v1.1.2 (published about 1 year ago)
  • Last Synced: 2024-11-11T01:31:28.228Z (about 1 month ago)
  • Versions: 2
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Rankings:
    • Forks count: 1.431%
    • Stargazers count: 1.697%
    • Average: 4.868%
    • Dependent packages count: 6.999%
    • Dependent repos count: 9.346%
go: github.com/gorilla/contexT

Package context stores values shared during a request lifetime. Note: gorilla/context, having been born well before `context.Context` existed, does not play well > with the shallow copying of the request that [`http.Request.WithContext`](https://golang.org/pkg/net/http/#Request.WithContext) (added to net/http Go 1.7 onwards) performs. You should either use *just* gorilla/context, or moving forward, the new `http.Request.Context()`. For example, a router can set variables extracted from the URL and later application handlers can access those values, or it can be used to store sessions values to be saved at the end of a request. There are several others common uses. The idea was posted by Brad Fitzpatrick to the go-nuts mailing list: Here's the basic usage: first define the keys that you will need. The key type is interface{} so a key can be of any type that supports equality. Here we define a key using a custom int type to avoid name collisions: Then set a variable. Variables are bound to an http.Request object, so you need a request instance to set a value: The application can later access the variable using the same key you provided: And that's all about the basic usage. We discuss some other ideas below. Any type can be stored in the context. To enforce a given type, make the key private and wrap Get() and Set() to accept and return values of a specific type: Variables must be cleared at the end of a request, to remove all values that were stored. This can be done in an http.Handler, after a request was served. Just call Clear() passing the request: ...or use ClearHandler(), which conveniently wraps an http.Handler to clear variables at the end of a request lifetime. The Routers from the packages gorilla/mux and gorilla/pat call Clear() so if you are using either of them you don't need to clear the context manually.

  • Homepage: https://github.com/gorilla/contexT
  • Documentation: https://pkg.go.dev/github.com/gorilla/contexT#section-documentation
  • Licenses: BSD-3-Clause
  • Latest release: v1.1.2 (published about 1 year ago)
  • Last Synced: 2024-11-11T01:31:30.827Z (about 1 month ago)
  • Versions: 2
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Rankings:
    • Forks count: 1.431%
    • Stargazers count: 1.697%
    • Average: 4.868%
    • Dependent packages count: 6.999%
    • Dependent repos count: 9.346%
go: github.com/GORILLA/context

Package context stores values shared during a request lifetime. Note: gorilla/context, having been born well before `context.Context` existed, does not play well > with the shallow copying of the request that [`http.Request.WithContext`](https://golang.org/pkg/net/http/#Request.WithContext) (added to net/http Go 1.7 onwards) performs. You should either use *just* gorilla/context, or moving forward, the new `http.Request.Context()`. For example, a router can set variables extracted from the URL and later application handlers can access those values, or it can be used to store sessions values to be saved at the end of a request. There are several others common uses. The idea was posted by Brad Fitzpatrick to the go-nuts mailing list: Here's the basic usage: first define the keys that you will need. The key type is interface{} so a key can be of any type that supports equality. Here we define a key using a custom int type to avoid name collisions: Then set a variable. Variables are bound to an http.Request object, so you need a request instance to set a value: The application can later access the variable using the same key you provided: And that's all about the basic usage. We discuss some other ideas below. Any type can be stored in the context. To enforce a given type, make the key private and wrap Get() and Set() to accept and return values of a specific type: Variables must be cleared at the end of a request, to remove all values that were stored. This can be done in an http.Handler, after a request was served. Just call Clear() passing the request: ...or use ClearHandler(), which conveniently wraps an http.Handler to clear variables at the end of a request lifetime. The Routers from the packages gorilla/mux and gorilla/pat call Clear() so if you are using either of them you don't need to clear the context manually.

  • Homepage: https://github.com/GORILLA/context
  • Documentation: https://pkg.go.dev/github.com/GORILLA/context#section-documentation
  • Licenses: BSD-3-Clause
  • Latest release: v1.1.2 (published about 1 year ago)
  • Last Synced: 2024-11-11T01:31:41.074Z (about 1 month ago)
  • Versions: 2
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Rankings:
    • Forks count: 1.431%
    • Stargazers count: 1.697%
    • Average: 4.868%
    • Dependent packages count: 6.999%
    • Dependent repos count: 9.346%

Dependencies

.github/workflows/issues.yml actions
  • actions/add-to-project v0.5.0 composite
.github/workflows/security.yml actions
  • actions/checkout v3 composite
  • actions/setup-go v4 composite
  • golang/govulncheck-action v1 composite
  • securego/gosec master composite
.github/workflows/test.yml actions
  • actions/checkout v3 composite
  • actions/setup-go v4 composite
  • codecov/codecov-action v3 composite
.github/workflows/verify.yml actions
  • actions/checkout v3 composite
  • actions/setup-go v4 composite
  • golangci/golangci-lint-action v3 composite
go.mod go