utils

package module
v0.0.0-...-258f086 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2023 License: Unlicense Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ConstDefaultDateFormat = "2006-01-02 15:04:05"
	RedisDevices           = "devices"
	RedisLocations         = "locations"
	RedisOnlines           = "onlines"
	RedisHeartBeat         = "heart_beats"
	RedisX3InGt            = "X3InGt"
	RedisGtInX3            = "GtInX3"
	RedisLocationList      = "locList"
	RedisLbsLocation       = "lbs_locations"
)

Variables

This section is empty.

Functions

func AddDate

func AddDate(mode string) time.Time

func ConvertByteToHex

func ConvertByteToHex(input []byte) []string

func ConvertByteToString

func ConvertByteToString(input []byte) string

func ConvertHexToByte

func ConvertHexToByte(input []string) []byte

func DecodeLocation

func DecodeLocation(latitude float64) float64

func FailOnError

func FailOnError(err error, msg string)

func FormatDate

func FormatDate(time time.Time) string

func GenerateIsoDate

func GenerateIsoDate(dateTime string) time.Time

func GetDate

func GetDate(format ...string) (string, error)

func GetDateDiff

func GetDateDiff(t time.Time) int64

func GetDateWithFormat

func GetDateWithFormat(format ...string) string

func GetDeviceImei

func GetDeviceImei(input []byte) string

func GetDistance

func GetDistance(p1 []float64, p2 []float64) float64

func GetIranLocation

func GetIranLocation() (*time.Location, error)

func GetLocalizedTime

func GetLocalizedTime() time.Time

func GetPackageSn

func GetPackageSn(input []byte) string

func GetPackageSnInNumber

func GetPackageSnInNumber(input []byte) int

func GetRemoteAddr

func GetRemoteAddr(remoteAddr string) string

func InitLogger

func InitLogger(filePath string) (*zap.Logger, error)

func IsConcox

func IsConcox(packet []byte) bool

func IsLogin

func IsLogin(packet []byte) bool

func IsOnlineRequest

func IsOnlineRequest(packet []byte) bool

func LeftPad2Len

func LeftPad2Len(s string, padStr string, overallLen int) string

func Rad

func Rad(x float64) float64

func Round

func Round(num float64) int

func SortArray

func SortArray(array [][]byte) [][]byte

func SplitPackage

func SplitPackage(input []byte, array [][]byte) [][]byte

func ToFixed

func ToFixed(num float64, precision int) float64

Types

type WriteSyncer

type WriteSyncer struct {
	io.Writer
}

func (WriteSyncer) Sync

func (ws WriteSyncer) Sync() error

Directories

Path Synopsis
devices
internal/queue
Package queue delivers an implementation of lock-free concurrent queue based on the algorithm presented by Maged M. Michael and Michael L. Scot.
Package queue delivers an implementation of lock-free concurrent queue based on the algorithm presented by Maged M. Michael and Michael L. Scot.
internal/socket
Package socket provides functions that return fd and net.Addr based on given the protocol and address with a SO_REUSEPORT option set to the socket.
Package socket provides functions that return fd and net.Addr based on given the protocol and address with a SO_REUSEPORT option set to the socket.
pkg/logging
Package logging provides logging functionality for gnet server, it sets up a default logger (powered by go.uber.org/zap) which is about to be used by gnet server, it also allows users to replace the default logger with their customized logger by just implementing the `Logger` interface and assign it to the functional option `Options.Logger`, pass it to `gnet.Serve` method.
Package logging provides logging functionality for gnet server, it sets up a default logger (powered by go.uber.org/zap) which is about to be used by gnet server, it also allows users to replace the default logger with their customized logger by just implementing the `Logger` interface and assign it to the functional option `Options.Logger`, pass it to `gnet.Serve` method.

Jump to

Keyboard shortcuts

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