mirror of
https://github.com/gin-gonic/gin.git
synced 2025-10-18 23:12:17 +08:00
context add GetUint & GetInt64 method
This commit is contained in:
parent
5e40c1d49c
commit
ead857e570
16
context.go
16
context.go
@ -287,6 +287,14 @@ func (c *Context) GetInt(key string) (i int) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GetUint returns the value associated with the key as an unsigned integer.
|
||||||
|
func (c *Context) GetUint(key string) (ui uint) {
|
||||||
|
if val, ok := c.Get(key); ok && val != nil {
|
||||||
|
ui, _ = val.(uint)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
// GetInt64 returns the value associated with the key as an integer.
|
// GetInt64 returns the value associated with the key as an integer.
|
||||||
func (c *Context) GetInt64(key string) (i64 int64) {
|
func (c *Context) GetInt64(key string) (i64 int64) {
|
||||||
if val, ok := c.Get(key); ok && val != nil {
|
if val, ok := c.Get(key); ok && val != nil {
|
||||||
@ -295,6 +303,14 @@ func (c *Context) GetInt64(key string) (i64 int64) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GetInt64 returns the value associated with the key as an unsigned integer.
|
||||||
|
func (c *Context) GetUint64(key string) (ui64 uint64) {
|
||||||
|
if val, ok := c.Get(key); ok && val != nil {
|
||||||
|
ui64, _ = val.(uint64)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
// GetFloat64 returns the value associated with the key as a float64.
|
// GetFloat64 returns the value associated with the key as a float64.
|
||||||
func (c *Context) GetFloat64(key string) (f64 float64) {
|
func (c *Context) GetFloat64(key string) (f64 float64) {
|
||||||
if val, ok := c.Get(key); ok && val != nil {
|
if val, ok := c.Get(key); ok && val != nil {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user