common

package
v1.1.3 Latest Latest
Warning

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

Go to latest
Published: Dec 25, 2020 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MapLength           int32  = 990
	MapHeight           int32  = 990
	ChunkSize           int32  = 30
	MainCityLength      uint32 = 200
	MainCityHeight      uint32 = 200
	MainCitySize               = MainCityLength * MainCityHeight
	WorldMainCityWidth  int32  = 2
	WorldMainCityHeight int32  = 2
)

Variables

View Source
var (
	BuffPool = sync.Pool{
		New: func() interface{} {
			return bytes.NewBuffer([]byte{})
		},
	}
)

Functions

func AddUint64ToSlice

func AddUint64ToSlice(slice []uint64, value uint64) []uint64

func AddVersionInfoBeforeData

func AddVersionInfoBeforeData(data []byte, version int32) []byte

func Base64Decode

func Base64Decode(in string) string

func Base64Encode

func Base64Encode(in string) string

func BitIsSet

func BitIsSet(value uint32, position uint32) bool

func BoolToString

func BoolToString(input bool) string

func Bresenham

func Bresenham(x1, y1, x2, y2 int32) []int32

func CheckBirthdayValid

func CheckBirthdayValid(nYear, nMonth, nDay int) bool

生日日期格式效验

func CheckIntersectSquareAndBeeline

func CheckIntersectSquareAndBeeline(square ChartCoordinate, beeline ChartCoordinate) bool

func CheckProvinceValid

func CheckProvinceValid(citizenNo []byte) bool

省份号码效验

func CheckTileidValid

func CheckTileidValid(id int32) bool

func Clone

func Clone(pb proto.Message) proto.Message

func CombineMap

func CombineMap(m1 ...map[string]string) map[string]string

func ComputeInt32Slice

func ComputeInt32Slice(slice []int32) int32

func ComputeUint32Slice

func ComputeUint32Slice(slice []uint32) uint32

func ConverToInt

func ConverToInt(in interface{}) int

func ConverToInt32

func ConverToInt32(in interface{}) int32

func ConverToInt64

func ConverToInt64(in interface{}) int64

func ConverToUint32

func ConverToUint32(in interface{}) uint32

func ConverToUint64

func ConverToUint64(in interface{}) uint64

func ConvertCoordinateToId

func ConvertCoordinateToId(x int32, y int32, sid int32) int32

func ConvertIdToCoordinate

func ConvertIdToCoordinate(id int32) (int32, int32, int32)

func ConvertMainCityCoordinateToId

func ConvertMainCityCoordinateToId(x, y uint32) uint32

func ConvertMainCityIdToCoordinate

func ConvertMainCityIdToCoordinate(id uint32) (uint32, uint32)

func ConvertToBytes

func ConvertToBytes(in interface{}) []byte

func ConvertToString

func ConvertToString(in interface{}) string

func CopyUint64Map

func CopyUint64Map(in map[uint64]uint64) map[uint64]uint64

func CopyUint64Slice

func CopyUint64Slice(input []uint64) []uint64

func CountMarchDistance

func CountMarchDistance(startid, endid int32) uint64

func Cross

func Cross(p1x, p1y, p2x, p2y, p3x, p3y int32) int32

func DelNum

func DelNum(a, b int32) int32

func DeleteInt64ToSlice

func DeleteInt64ToSlice(slice []int64, value int64) []int64

func DeleteUint32FromSlice

func DeleteUint32FromSlice(slice []uint32, value uint32) []uint32

func DeleteUint64ToSlice

func DeleteUint64ToSlice(slice []uint64, value uint64) []uint64

func Float64ToString

func Float64ToString(input float64) string

func GenGuid

func GenGuid() string

func GetChunkIdx

func GetChunkIdx(tileId int32) int

func GetCitizenNoInfo

func GetCitizenNoInfo(citizenNo []byte) (err error, birthday time.Time, sex string, address string)

得到身份证号码,生日, 性别, 省份地址信息

func GetMd5String

func GetMd5String(s string) string

func GetOccupyTileIDList

func GetOccupyTileIDList(tileid, width, height int32) []int32

func GetRandPerm

func GetRandPerm(in int) []int

func GetRandomLocation

func GetRandomLocation() int32

func GetRandomNum

func GetRandomNum(in int32) int32

func GetSquareTileid

func GetSquareTileid(centerid, width, height int32) (int32, int32)

func GetTileIdList

func GetTileIdList(centerid, width, height int32) []int32

func GetTileidByMarchTime

func GetTileidByMarchTime(startid, endid int32, marchtime, totalmarchtime uint64) int32

func GetValueByPR

func GetValueByPR(pr, values []int32) (ret1 []int32)

权重概率

func InsertSplitK

func InsertSplitK(u64 uint64) string

func Int32MapNum

func Int32MapNum(conf []int32, new *[]int32) (num int)

---------------身份证 end-------------------- 对比切片

func Int32SliceContant

func Int32SliceContant(slice *[]int32, value int32) bool

func Int32ToString

func Int32ToString(input int32) string

func Int64ToString

func Int64ToString(input int64) string

func IsDirExists

func IsDirExists(path string) bool

func IsFileExists

func IsFileExists(file string) bool

func IsLeapYear

func IsLeapYear(nYear int) bool

func IsMobile

func IsMobile(text string) bool

func IsValidCitizenNo

func IsValidCitizenNo(citizenNo []byte) bool

效验有效地身份证号码

func IsValidCitizenNo18

func IsValidCitizenNo18(citizenNo18 []byte) bool

效验18位身份证

func Link(args ...interface{}) (ret string)

func MapInit added in v1.1.3

func MapInit(input interface{})

func Max

func Max(a, b int32) int32

func MemSet

func MemSet(s unsafe.Pointer, c byte, n uintptr)

func Min

func Min(a, b int32) int32

func ParseParameterStringToMap

func ParseParameterStringToMap(in string) map[string]string

func ParseStringToFloat64List

func ParseStringToFloat64List(input string) []float64

func ParseStringToInt64List

func ParseStringToInt64List(input string) []int64

func ParseStringToMap

func ParseStringToMap(input string) (map[uint64]uint64, map[uint64]uint64)

func ParseStringToUint32List

func ParseStringToUint32List(input string) []uint32

func ParseStringToUint64List

func ParseStringToUint64List(input string) []uint64

func ProcessTime

func ProcessTime(duration uint64) string

func ResetBit

func ResetBit(value *uint32, position uint32)

func Segment

func Segment(p1x, p1y, p2x, p2y, p3x, p3y, p4x, p4y int32) bool

func SetBit

func SetBit(value *uint32, position uint32)

func StatueFuncArrayToMap

func StatueFuncArrayToMap(keys []string, values []uint32) map[string]uint32

* @brief 雕像加成key-value array转换为map

func StatueFuncArrayToString

func StatueFuncArrayToString(keys []string, values []uint32, perValue uint32) string

* @brief 雕像加成key-value array转换为string

func StatueFuncMapToString

func StatueFuncMapToString(d map[string]string) string

func StringFormatGtime

func StringFormatGtime(dateStr string) int64

parse string(DATE) like 20170804 to UTC timestamp

func StringSliceContant

func StringSliceContant(slice []string, value string) bool

func StringToBool

func StringToBool(input string) bool

func StringToFloat64

func StringToFloat64(input string) float64

func StringToInt

func StringToInt(input string) int

func StringToInt32

func StringToInt32(input string) int32

func StringToInt64

func StringToInt64(input string) int64

func StringToUint32

func StringToUint32(input string) uint32

func StringToUint64

func StringToUint64(input string) uint64

func StructInit added in v1.1.3

func StructInit(input interface{})

func TimeFormatString

func TimeFormatString(duration uint64) string

func Uint32SliceContant

func Uint32SliceContant(slice []uint32, value uint32) bool

func Uint32ToString

func Uint32ToString(input uint32) string

func Uint64SliceContant

func Uint64SliceContant(slice []uint64, value uint64) bool

func Uint64ToString

func Uint64ToString(input uint64) string

Types

type ChartCoordinate

type ChartCoordinate struct {
	Start PointCoordinate
	End   PointCoordinate
}

type PointCoordinate

type PointCoordinate struct {
	X, Y float64
}

Jump to

Keyboard shortcuts

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