utils

package
v0.0.0-...-833a7b1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 3, 2021 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Copyright 2014 loolgame Author. All Rights Reserved.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright 2014 loolgame Author. All Rights Reserved.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright 2014 mqant Author. All Rights Reserved.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright 2014 mqant Author. All Rights Reserved.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright 2014 mqantserver Author. All Rights Reserved.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright 2014 mqantserver Author. All Rights Reserved.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

View Source
const CODE62 = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
View Source
const CODE_LENTH = 62

Variables

View Source
var EDOC = map[string]int64{"0": 0, "1": 1, "2": 2, "3": 3, "4": 4, "5": 5, "6": 6, "7": 7, "8": 8, "9": 9, "a": 10, "b": 11, "c": 12, "d": 13, "e": 14, "f": 15, "g": 16, "h": 17, "i": 18, "j": 19, "k": 20, "l": 21, "m": 22, "n": 23, "o": 24, "p": 25, "q": 26, "r": 27, "s": 28, "t": 29, "u": 30, "v": 31, "w": 32, "x": 33, "y": 34, "z": 35, "A": 36, "B": 37, "C": 38, "D": 39, "E": 40, "F": 41, "G": 42, "H": 43, "I": 44, "J": 45, "K": 46, "L": 47, "M": 48, "N": 49, "O": 50, "P": 51, "Q": 52, "R": 53, "S": 54, "T": 55, "U": 56, "V": 57, "W": 58, "X": 59, "Y": 60, "Z": 61}

Functions

func Base62ToInt

func Base62ToInt(str string) int64

*

  • 解码字符串为整数

func BoolToBytes

func BoolToBytes(v bool) []byte

func BytesToBool

func BytesToBool(buf []byte) bool

func BytesToFloat32

func BytesToFloat32(bytes []byte) float32

func BytesToFloat64

func BytesToFloat64(bytes []byte) float64

func BytesToInt32

func BytesToInt32(buf []byte) int32

func BytesToInt64

func BytesToInt64(buf []byte) int64

func BytesToMap

func BytesToMap(bytes []byte) (map[string]interface{}, error)

func BytesToMapString

func BytesToMapString(bytes []byte) (map[string]string, error)

func Float32ToBytes

func Float32ToBytes(float float32) []byte

func Float64ToBytes

func Float64ToBytes(float float64) []byte

func Go

func Go(f func())

func Idle

func Idle() bool

func Int32ToBytes

func Int32ToBytes(i int32) []byte

func Int64ToBytes

func Int64ToBytes(i int64) []byte

func IntToBase62

func IntToBase62(number int64) string

*

  • 编码 整数 为 base62 字符串

func MapToBytes

func MapToBytes(jmap map[string]interface{}) ([]byte, error)

func MapToBytesString

func MapToBytesString(jmap map[string]string) ([]byte, error)

func RandInt64

func RandInt64(min, max int64) int64

func Struct2Map

func Struct2Map(obj interface{}) map[string]interface{}

Types

type BeeMap

type BeeMap struct {
	// contains filtered or unexported fields
}

BeeMap is a map with lock

func NewBeeMap

func NewBeeMap() *BeeMap

NewBeeMap return new safemap

func (*BeeMap) Check

func (m *BeeMap) Check(k interface{}) bool

Check Returns true if k is exist in the map.

func (*BeeMap) Delete

func (m *BeeMap) Delete(k interface{})

Delete the given key and value.

func (*BeeMap) DeleteAll

func (m *BeeMap) DeleteAll()

func (*BeeMap) Get

func (m *BeeMap) Get(k interface{}) interface{}

Get from maps return the k's value

func (*BeeMap) Items

func (m *BeeMap) Items() map[interface{}]interface{}

Items returns all items in safemap.

func (*BeeMap) Keys

func (m *BeeMap) Keys() *[]interface{}

func (*BeeMap) Set

func (m *BeeMap) Set(k interface{}, v interface{}) bool

Set Maps the given key and value. Returns false if the key is already in the map and changes nothing.

func (*BeeMap) Size

func (m *BeeMap) Size() int

type RedisFactory

type RedisFactory struct {
	// contains filtered or unexported fields
}

func GetRedisFactory

func GetRedisFactory() *RedisFactory

func (RedisFactory) CloseAllPool

func (this RedisFactory) CloseAllPool()

func (RedisFactory) GetPool

func (this RedisFactory) GetPool(url string) *redis.Pool

Directories

Path Synopsis
fatih
structs
Package structs contains various utilities functions to work with structs.
Package structs contains various utilities functions to work with structs.
Package lru implements an LRU cache.
Package lru implements an LRU cache.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL