mirror of
https://gitee.com/johng/gf
synced 2026-07-07 06:15:15 +08:00
优化框架gmap/gjson/gparser/gcfg包,增加常用的基本数据类型转换获取方法
This commit is contained in:
@ -10,6 +10,7 @@ package gmap
|
||||
import (
|
||||
"sync"
|
||||
"gitee.com/johng/gf/g/util/gconv"
|
||||
"time"
|
||||
)
|
||||
|
||||
type UintInterfaceMap struct {
|
||||
@ -79,7 +80,6 @@ func (this *UintInterfaceMap) GetWithDefault(key uint, value interface{}) interf
|
||||
this.mu.Unlock()
|
||||
return val
|
||||
}
|
||||
|
||||
func (this *UintInterfaceMap) GetBool(key uint) bool {
|
||||
return gconv.Bool(this.Get(key))
|
||||
}
|
||||
@ -88,10 +88,42 @@ func (this *UintInterfaceMap) GetInt(key uint) int {
|
||||
return gconv.Int(this.Get(key))
|
||||
}
|
||||
|
||||
func (this *UintInterfaceMap) GetInt8(key uint) int8 {
|
||||
return gconv.Int8(this.Get(key))
|
||||
}
|
||||
|
||||
func (this *UintInterfaceMap) GetInt16(key uint) int16 {
|
||||
return gconv.Int16(this.Get(key))
|
||||
}
|
||||
|
||||
func (this *UintInterfaceMap) GetInt32(key uint) int32 {
|
||||
return gconv.Int32(this.Get(key))
|
||||
}
|
||||
|
||||
func (this *UintInterfaceMap) GetInt64(key uint) int64 {
|
||||
return gconv.Int64(this.Get(key))
|
||||
}
|
||||
|
||||
func (this *UintInterfaceMap) GetUint (key uint) uint {
|
||||
return gconv.Uint(this.Get(key))
|
||||
}
|
||||
|
||||
func (this *UintInterfaceMap) GetUint8 (key uint) uint8 {
|
||||
return gconv.Uint8(this.Get(key))
|
||||
}
|
||||
|
||||
func (this *UintInterfaceMap) GetUint16 (key uint) uint16 {
|
||||
return gconv.Uint16(this.Get(key))
|
||||
}
|
||||
|
||||
func (this *UintInterfaceMap) GetUint32 (key uint) uint32 {
|
||||
return gconv.Uint32(this.Get(key))
|
||||
}
|
||||
|
||||
func (this *UintInterfaceMap) GetUint64 (key uint) uint64 {
|
||||
return gconv.Uint64(this.Get(key))
|
||||
}
|
||||
|
||||
func (this *UintInterfaceMap) GetFloat32 (key uint) float32 {
|
||||
return gconv.Float32(this.Get(key))
|
||||
}
|
||||
@ -104,6 +136,18 @@ func (this *UintInterfaceMap) GetString (key uint) string {
|
||||
return gconv.String(this.Get(key))
|
||||
}
|
||||
|
||||
func (this *UintInterfaceMap) GetStrings (key uint) []string {
|
||||
return gconv.Strings(this.Get(key))
|
||||
}
|
||||
|
||||
func (this *UintInterfaceMap) GetTime (key uint, format...string) time.Time {
|
||||
return gconv.Time(this.Get(key), format...)
|
||||
}
|
||||
|
||||
func (this *UintInterfaceMap) GetTimeDuration (key uint) time.Duration {
|
||||
return gconv.TimeDuration(this.Get(key))
|
||||
}
|
||||
|
||||
// 删除键值对
|
||||
func (this *UintInterfaceMap) Remove(key uint) {
|
||||
this.mu.Lock()
|
||||
|
||||
Reference in New Issue
Block a user