helpers

package
v0.0.0-...-c4db811 Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2018 License: MIT Imports: 19 Imported by: 23

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DB *sql.DB

DB Database

Functions

func CalculateAccuracy

func CalculateAccuracy(count300 uint64, count100 uint64, count50 uint64, countMiss uint64, countGeki uint64, countKatu uint64, playMode byte) float64

CalculateAccuracy calculates every playModes accuracy.

func Connect

func Connect(c *consts.MySQLConf)

Connect to MySQL Database

func CreateConfig

func CreateConfig(configName string, conf interface{})

CreateConfig creates a config for the given configName and marshals a struct into it.

func Download

func Download(URL string) (file []byte, err error)

Download is downloading the content and returns the body. mostly used for downloading a file.

func DownloadBeatmapbyName

func DownloadBeatmapbyName(BeatmapName string) (string, error)

DownloadBeatmapbyName Downloads a Beatmap from OSU!

func Exists

func Exists(Path string) bool

Exists is gonna check if a file exists, (IF return true else false)

func GetConfig

func GetConfig(configName string, c interface{})

GetConfig unmarshals a .yml file of the given configName

func GetIPInfo

func GetIPInfo(ip string) *consts.GeoIP

We're going to use http://ip.zxq.co/, because why not ? GetIPInfo is gonna get the IP Information where the User is located at.

func HasPrivileges

func HasPrivileges(p uint64, u *consts.User) bool

HasPrivileges if user has those permissions else not!

func MD5

func MD5(I []byte) (out []byte, err error)

MD5 Converts a []byte Array to a MD5 Hash.

func MD5File

func MD5File(Path string) ([]byte, error)

MD5File reads a File and generates a md5 hash out of it.

func MD5String

func MD5String(String string) ([]byte, error)

MD5String Converts a String to a MD5 Hash.

func NotExists

func NotExists(Path string) bool

NotExists is gonna check if a file doesn't exists, (IF Does not return true else false)

func Pseudorandombytes

func Pseudorandombytes(n int) []byte

Pseudorandombytes Generates a pseudo byte array. good for crypto.

func RandomString

func RandomString(n int) (ret string)

RandomString is just generate a random string. aA-zZ 0-9

func ToHumanAcc

func ToHumanAcc(acc float64) float64

ToHumanAcc is converting the Accuracy to a human readable Number. (Way smaller then E.G 0.895023981 // should be 89.50 % acc)

func Verify

func Verify(a, b []byte) bool

Verify to verify if both byte arrays are the same.

Types

This section is empty.

Jump to

Keyboard shortcuts

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