去掉gmap中常用的基本数据类型转换获取方法

This commit is contained in:
John 2018-07-01 09:42:42 +08:00
parent 18059838a1
commit 7fb898fa95
8 changed files with 0 additions and 551 deletions

View File

@ -9,8 +9,6 @@ package gmap
import (
"sync"
"gitee.com/johng/gf/g/util/gconv"
"time"
)
type IntIntMap struct {
@ -70,70 +68,6 @@ func (this *IntIntMap) Get(key int) (int) {
return val
}
func (this *IntIntMap) GetBool(key int) bool {
return gconv.Bool(this.Get(key))
}
func (this *IntIntMap) GetInt(key int) int {
return gconv.Int(this.Get(key))
}
func (this *IntIntMap) GetInt8(key int) int8 {
return gconv.Int8(this.Get(key))
}
func (this *IntIntMap) GetInt16(key int) int16 {
return gconv.Int16(this.Get(key))
}
func (this *IntIntMap) GetInt32(key int) int32 {
return gconv.Int32(this.Get(key))
}
func (this *IntIntMap) GetInt64(key int) int64 {
return gconv.Int64(this.Get(key))
}
func (this *IntIntMap) GetUint (key int) uint {
return gconv.Uint(this.Get(key))
}
func (this *IntIntMap) GetUint8 (key int) uint8 {
return gconv.Uint8(this.Get(key))
}
func (this *IntIntMap) GetUint16 (key int) uint16 {
return gconv.Uint16(this.Get(key))
}
func (this *IntIntMap) GetUint32 (key int) uint32 {
return gconv.Uint32(this.Get(key))
}
func (this *IntIntMap) GetUint64 (key int) uint64 {
return gconv.Uint64(this.Get(key))
}
func (this *IntIntMap) GetFloat32 (key int) float32 {
return gconv.Float32(this.Get(key))
}
func (this *IntIntMap) GetFloat64 (key int) float64 {
return gconv.Float64(this.Get(key))
}
func (this *IntIntMap) GetString (key int) string {
return gconv.String(this.Get(key))
}
func (this *IntIntMap) GetTime (key int, format...string) time.Time {
return gconv.Time(this.Get(key), format...)
}
func (this *IntIntMap) GetTimeDuration (key int) time.Duration {
return gconv.TimeDuration(this.Get(key))
}
// 获取键值,如果键值不存在则写入默认值
func (this *IntIntMap) GetWithDefault(key int, value int) int {
this.mu.Lock()

View File

@ -9,8 +9,6 @@ package gmap
import (
"sync"
"gitee.com/johng/gf/g/util/gconv"
"time"
)
type IntInterfaceMap struct {
@ -82,74 +80,6 @@ func (this *IntInterfaceMap) GetWithDefault(key int, value interface{}) interfac
return val
}
func (this *IntInterfaceMap) GetBool(key int) bool {
return gconv.Bool(this.Get(key))
}
func (this *IntInterfaceMap) GetInt(key int) int {
return gconv.Int(this.Get(key))
}
func (this *IntInterfaceMap) GetInt8(key int) int8 {
return gconv.Int8(this.Get(key))
}
func (this *IntInterfaceMap) GetInt16(key int) int16 {
return gconv.Int16(this.Get(key))
}
func (this *IntInterfaceMap) GetInt32(key int) int32 {
return gconv.Int32(this.Get(key))
}
func (this *IntInterfaceMap) GetInt64(key int) int64 {
return gconv.Int64(this.Get(key))
}
func (this *IntInterfaceMap) GetUint (key int) uint {
return gconv.Uint(this.Get(key))
}
func (this *IntInterfaceMap) GetUint8 (key int) uint8 {
return gconv.Uint8(this.Get(key))
}
func (this *IntInterfaceMap) GetUint16 (key int) uint16 {
return gconv.Uint16(this.Get(key))
}
func (this *IntInterfaceMap) GetUint32 (key int) uint32 {
return gconv.Uint32(this.Get(key))
}
func (this *IntInterfaceMap) GetUint64 (key int) uint64 {
return gconv.Uint64(this.Get(key))
}
func (this *IntInterfaceMap) GetFloat32 (key int) float32 {
return gconv.Float32(this.Get(key))
}
func (this *IntInterfaceMap) GetFloat64 (key int) float64 {
return gconv.Float64(this.Get(key))
}
func (this *IntInterfaceMap) GetString (key int) string {
return gconv.String(this.Get(key))
}
func (this *IntInterfaceMap) GetStrings (key int) []string {
return gconv.Strings(this.Get(key))
}
func (this *IntInterfaceMap) GetTime (key int, format...string) time.Time {
return gconv.Time(this.Get(key), format...)
}
func (this *IntInterfaceMap) GetTimeDuration (key int) time.Duration {
return gconv.TimeDuration(this.Get(key))
}
// 删除键值对
func (this *IntInterfaceMap) Remove(key int) {
this.mu.Lock()

View File

@ -9,8 +9,6 @@ package gmap
import (
"sync"
"gitee.com/johng/gf/g/util/gconv"
"time"
)
type IntStringMap struct {
@ -70,70 +68,6 @@ func (this *IntStringMap) Get(key int) string {
return val
}
func (this *IntStringMap) GetBool(key int) bool {
return gconv.Bool(this.Get(key))
}
func (this *IntStringMap) GetInt(key int) int {
return gconv.Int(this.Get(key))
}
func (this *IntStringMap) GetInt8(key int) int8 {
return gconv.Int8(this.Get(key))
}
func (this *IntStringMap) GetInt16(key int) int16 {
return gconv.Int16(this.Get(key))
}
func (this *IntStringMap) GetInt32(key int) int32 {
return gconv.Int32(this.Get(key))
}
func (this *IntStringMap) GetInt64(key int) int64 {
return gconv.Int64(this.Get(key))
}
func (this *IntStringMap) GetUint (key int) uint {
return gconv.Uint(this.Get(key))
}
func (this *IntStringMap) GetUint8 (key int) uint8 {
return gconv.Uint8(this.Get(key))
}
func (this *IntStringMap) GetUint16 (key int) uint16 {
return gconv.Uint16(this.Get(key))
}
func (this *IntStringMap) GetUint32 (key int) uint32 {
return gconv.Uint32(this.Get(key))
}
func (this *IntStringMap) GetUint64 (key int) uint64 {
return gconv.Uint64(this.Get(key))
}
func (this *IntStringMap) GetFloat32 (key int) float32 {
return gconv.Float32(this.Get(key))
}
func (this *IntStringMap) GetFloat64 (key int) float64 {
return gconv.Float64(this.Get(key))
}
func (this *IntStringMap) GetString (key int) string {
return gconv.String(this.Get(key))
}
func (this *IntStringMap) GetTime (key int, format...string) time.Time {
return gconv.Time(this.Get(key), format...)
}
func (this *IntStringMap) GetTimeDuration (key int) time.Duration {
return gconv.TimeDuration(this.Get(key))
}
// 获取键值,如果键值不存在则写入默认值
func (this *IntStringMap) GetWithDefault(key int, value string) string {
this.mu.Lock()

View File

@ -9,8 +9,6 @@ package gmap
import (
"sync"
"gitee.com/johng/gf/g/util/gconv"
"time"
)
type InterfaceInterfaceMap struct {
@ -82,74 +80,6 @@ func (this *InterfaceInterfaceMap) GetWithDefault(key interface{}, value interfa
return val
}
func (this *InterfaceInterfaceMap) GetBool(key interface{}) bool {
return gconv.Bool(this.Get(key))
}
func (this *InterfaceInterfaceMap) GetInt(key interface{}) int {
return gconv.Int(this.Get(key))
}
func (this *InterfaceInterfaceMap) GetInt8(key interface{}) int8 {
return gconv.Int8(this.Get(key))
}
func (this *InterfaceInterfaceMap) GetInt16(key interface{}) int16 {
return gconv.Int16(this.Get(key))
}
func (this *InterfaceInterfaceMap) GetInt32(key interface{}) int32 {
return gconv.Int32(this.Get(key))
}
func (this *InterfaceInterfaceMap) GetInt64(key interface{}) int64 {
return gconv.Int64(this.Get(key))
}
func (this *InterfaceInterfaceMap) GetUint (key interface{}) uint {
return gconv.Uint(this.Get(key))
}
func (this *InterfaceInterfaceMap) GetUint8 (key interface{}) uint8 {
return gconv.Uint8(this.Get(key))
}
func (this *InterfaceInterfaceMap) GetUint16 (key interface{}) uint16 {
return gconv.Uint16(this.Get(key))
}
func (this *InterfaceInterfaceMap) GetUint32 (key interface{}) uint32 {
return gconv.Uint32(this.Get(key))
}
func (this *InterfaceInterfaceMap) GetUint64 (key interface{}) uint64 {
return gconv.Uint64(this.Get(key))
}
func (this *InterfaceInterfaceMap) GetFloat32 (key interface{}) float32 {
return gconv.Float32(this.Get(key))
}
func (this *InterfaceInterfaceMap) GetFloat64 (key interface{}) float64 {
return gconv.Float64(this.Get(key))
}
func (this *InterfaceInterfaceMap) GetString (key interface{}) string {
return gconv.String(this.Get(key))
}
func (this *InterfaceInterfaceMap) GetStrings (key interface{}) []string {
return gconv.Strings(this.Get(key))
}
func (this *InterfaceInterfaceMap) GetTime (key interface{}, format...string) time.Time {
return gconv.Time(this.Get(key), format...)
}
func (this *InterfaceInterfaceMap) GetTimeDuration (key interface{}) time.Duration {
return gconv.TimeDuration(this.Get(key))
}
// 删除键值对
func (this *InterfaceInterfaceMap) Remove(key interface{}) {
this.mu.Lock()

View File

@ -9,8 +9,6 @@ package gmap
import (
"sync"
"gitee.com/johng/gf/g/util/gconv"
"time"
)
type StringIntMap struct {
@ -70,74 +68,6 @@ func (this *StringIntMap) Get(key string) int {
return val
}
func (this *StringIntMap) GetBool(key string) bool {
return gconv.Bool(this.Get(key))
}
func (this *StringIntMap) GetInt(key string) int {
return gconv.Int(this.Get(key))
}
func (this *StringIntMap) GetInt8(key string) int8 {
return gconv.Int8(this.Get(key))
}
func (this *StringIntMap) GetInt16(key string) int16 {
return gconv.Int16(this.Get(key))
}
func (this *StringIntMap) GetInt32(key string) int32 {
return gconv.Int32(this.Get(key))
}
func (this *StringIntMap) GetInt64(key string) int64 {
return gconv.Int64(this.Get(key))
}
func (this *StringIntMap) GetUint (key string) uint {
return gconv.Uint(this.Get(key))
}
func (this *StringIntMap) GetUint8 (key string) uint8 {
return gconv.Uint8(this.Get(key))
}
func (this *StringIntMap) GetUint16 (key string) uint16 {
return gconv.Uint16(this.Get(key))
}
func (this *StringIntMap) GetUint32 (key string) uint32 {
return gconv.Uint32(this.Get(key))
}
func (this *StringIntMap) GetUint64 (key string) uint64 {
return gconv.Uint64(this.Get(key))
}
func (this *StringIntMap) GetFloat32 (key string) float32 {
return gconv.Float32(this.Get(key))
}
func (this *StringIntMap) GetFloat64 (key string) float64 {
return gconv.Float64(this.Get(key))
}
func (this *StringIntMap) GetString (key string) string {
return gconv.String(this.Get(key))
}
func (this *StringIntMap) GetStrings (key string) []string {
return gconv.Strings(this.Get(key))
}
func (this *StringIntMap) GetTime (key string, format...string) time.Time {
return gconv.Time(this.Get(key), format...)
}
func (this *StringIntMap) GetTimeDuration (key string) time.Duration {
return gconv.TimeDuration(this.Get(key))
}
// 获取键值,如果键值不存在则写入默认值
func (this *StringIntMap) GetWithDefault(key string, value int) int {
this.mu.Lock()

View File

@ -9,8 +9,6 @@ package gmap
import (
"sync"
"gitee.com/johng/gf/g/util/gconv"
"time"
)
type StringInterfaceMap struct {
@ -82,74 +80,6 @@ func (this *StringInterfaceMap) GetWithDefault(key string, value interface{}) in
return val
}
func (this *StringInterfaceMap) GetBool(key string) bool {
return gconv.Bool(this.Get(key))
}
func (this *StringInterfaceMap) GetInt(key string) int {
return gconv.Int(this.Get(key))
}
func (this *StringInterfaceMap) GetInt8(key string) int8 {
return gconv.Int8(this.Get(key))
}
func (this *StringInterfaceMap) GetInt16(key string) int16 {
return gconv.Int16(this.Get(key))
}
func (this *StringInterfaceMap) GetInt32(key string) int32 {
return gconv.Int32(this.Get(key))
}
func (this *StringInterfaceMap) GetInt64(key string) int64 {
return gconv.Int64(this.Get(key))
}
func (this *StringInterfaceMap) GetUint (key string) uint {
return gconv.Uint(this.Get(key))
}
func (this *StringInterfaceMap) GetUint8 (key string) uint8 {
return gconv.Uint8(this.Get(key))
}
func (this *StringInterfaceMap) GetUint16 (key string) uint16 {
return gconv.Uint16(this.Get(key))
}
func (this *StringInterfaceMap) GetUint32 (key string) uint32 {
return gconv.Uint32(this.Get(key))
}
func (this *StringInterfaceMap) GetUint64 (key string) uint64 {
return gconv.Uint64(this.Get(key))
}
func (this *StringInterfaceMap) GetFloat32 (key string) float32 {
return gconv.Float32(this.Get(key))
}
func (this *StringInterfaceMap) GetFloat64 (key string) float64 {
return gconv.Float64(this.Get(key))
}
func (this *StringInterfaceMap) GetString (key string) string {
return gconv.String(this.Get(key))
}
func (this *StringInterfaceMap) GetStrings (key string) []string {
return gconv.Strings(this.Get(key))
}
func (this *StringInterfaceMap) GetTime (key string, format...string) time.Time {
return gconv.Time(this.Get(key), format...)
}
func (this *StringInterfaceMap) GetTimeDuration (key string) time.Duration {
return gconv.TimeDuration(this.Get(key))
}
// 删除键值对
func (this *StringInterfaceMap) Remove(key string) {
this.mu.Lock()

View File

@ -9,8 +9,6 @@ package gmap
import (
"sync"
"gitee.com/johng/gf/g/util/gconv"
"time"
)
type StringStringMap struct {
@ -70,74 +68,6 @@ func (this *StringStringMap) Get(key string) string {
return val
}
func (this *StringStringMap) GetBool(key string) bool {
return gconv.Bool(this.Get(key))
}
func (this *StringStringMap) GetInt(key string) int {
return gconv.Int(this.Get(key))
}
func (this *StringStringMap) GetInt8(key string) int8 {
return gconv.Int8(this.Get(key))
}
func (this *StringStringMap) GetInt16(key string) int16 {
return gconv.Int16(this.Get(key))
}
func (this *StringStringMap) GetInt32(key string) int32 {
return gconv.Int32(this.Get(key))
}
func (this *StringStringMap) GetInt64(key string) int64 {
return gconv.Int64(this.Get(key))
}
func (this *StringStringMap) GetUint (key string) uint {
return gconv.Uint(this.Get(key))
}
func (this *StringStringMap) GetUint8 (key string) uint8 {
return gconv.Uint8(this.Get(key))
}
func (this *StringStringMap) GetUint16 (key string) uint16 {
return gconv.Uint16(this.Get(key))
}
func (this *StringStringMap) GetUint32 (key string) uint32 {
return gconv.Uint32(this.Get(key))
}
func (this *StringStringMap) GetUint64 (key string) uint64 {
return gconv.Uint64(this.Get(key))
}
func (this *StringStringMap) GetFloat32 (key string) float32 {
return gconv.Float32(this.Get(key))
}
func (this *StringStringMap) GetFloat64 (key string) float64 {
return gconv.Float64(this.Get(key))
}
func (this *StringStringMap) GetString (key string) string {
return gconv.String(this.Get(key))
}
func (this *StringStringMap) GetStrings (key string) []string {
return gconv.Strings(this.Get(key))
}
func (this *StringStringMap) GetTime (key string, format...string) time.Time {
return gconv.Time(this.Get(key), format...)
}
func (this *StringStringMap) GetTimeDuration (key string) time.Duration {
return gconv.TimeDuration(this.Get(key))
}
// 获取键值,如果键值不存在则写入默认值
func (this *StringStringMap) GetWithDefault(key string, value string) string {
this.mu.Lock()

View File

@ -9,8 +9,6 @@ package gmap
import (
"sync"
"gitee.com/johng/gf/g/util/gconv"
"time"
)
type UintInterfaceMap struct {
@ -80,73 +78,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))
}
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))
}
func (this *UintInterfaceMap) GetFloat64 (key uint) float64 {
return gconv.Float64(this.Get(key))
}
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) {