utils

package module
v0.0.0-...-511556d Latest Latest
Warning

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

Go to latest
Published: May 20, 2023 License: MIT Imports: 16 Imported by: 0

README

Void Project

Requirements

  • Go >= 1.13
  • PostgreSQL
  • DBeaver [Recommended]
  • Git Bash (for Windows)
  • Redis [Optional]
  • K8s cluster [Optional]
  • Docker repository [Optional]

Environment

The following environment variables have to be set on the running environment.

  • POSTGRES_HOST
  • POSTGRES_PORT
  • POSTGRES_USER
  • POSTGRES_PASSWORD
  • POSTGRES_DB
  • SERVER_IP
  • DROP_RATE
  • EXP_RATE
  • PROXY_ENABLED [Optional]
  • REDIS_HOST [Optional]
  • REDIS_PORT [Optional]
  • REDIS_PASSWORD [Optional]
  • REDIS_SCHEME [Optional]

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ByteArrayToHexString

func ByteArrayToHexString(array []byte, n int) (hex string)

func BytesToFloat

func BytesToFloat(arr []byte, reverse bool) float64

func BytesToInt

func BytesToInt(arr []byte, reverse bool) int64

func CalculateDistance

func CalculateDistance(loc1, loc2 *Location) float64

func Contains

func Contains(array interface{}, item interface{}) (bool, int)

func CreateBytes

func CreateBytes(value byte, length, size int) []byte

func CreateInts

func CreateInts(value, length, size int) []int

func FloatToBytes

func FloatToBytes(dec float64, bytes byte, reverse bool) []byte

func IntToBytes

func IntToBytes(dec uint64, bytes byte, reverse bool) []byte

func IntsToBytes

func IntsToBytes(ints ...int) []byte

func Keys

func Keys(a map[int]interface{}) []int

func MapDiff

func MapDiff(a, b map[interface{}]interface{}) map[interface{}]interface{}

func NewLog

func NewLog(file string, text string)

func ParseDate

func ParseDate(date null.Time) string

func ParseFloat

func ParseFloat(d string) float64

func PvPFunc

func PvPFunc(val int) int

func RandFloat

func RandFloat(min, max float64) float64

func RandFloats

func RandFloats(min, max float64, count int) []float64

func RandInt

func RandInt(min, max int64) int64

func RemoveAccents

func RemoveAccents(s string) string

func SearchUInt64

func SearchUInt64(a []uint64, x uint64) int

func SigmaFunc

func SigmaFunc(x float64) float64

func SliceDiff

func SliceDiff(a, b []int) []int

func StringToBool

func StringToBool(s string) bool

func StringToFloat64

func StringToFloat64(s string) float64

func StringToInt

func StringToInt(s string) int

Types

type Location

type Location struct {
	X float64
	Y float64
}

func (*Location) String

func (l *Location) String() string

type Packet

type Packet []byte

func (*Packet) Concat

func (p *Packet) Concat(data []byte)

func (*Packet) Insert

func (p *Packet) Insert(data []byte, i int)

func (*Packet) Overwrite

func (p *Packet) Overwrite(data []byte, i int)

func (*Packet) Print

func (p *Packet) Print()

func (*Packet) SetLength

func (p *Packet) SetLength(length int16)

type SMap

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

func NewMap

func NewMap() *SMap

func (*SMap) Add

func (m *SMap) Add(key, val interface{})

func (*SMap) Clear

func (m *SMap) Clear()

func (*SMap) Delete

func (m *SMap) Delete(key interface{})

func (*SMap) Get

func (m *SMap) Get(key interface{}) interface{}

func (*SMap) Keys

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

func (*SMap) PopValues

func (m *SMap) PopValues() []interface{}

func (*SMap) Values

func (m *SMap) Values() []interface{}

Jump to

Keyboard shortcuts

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