utils

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2023 License: AGPL-3.0 Imports: 15 Imported by: 0

Documentation

Overview

Package utils provides some cross used information

Package utils provides some cross used information

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ByteToMap added in v0.0.8

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

ByteToMap returns a map from bytes

func ByteToUint64 added in v0.0.8

func ByteToUint64(bytes []byte) uint64

ByteToUint64 return an uint64 from bytes

func Contains added in v0.0.6

func Contains(list interface{}, elem interface{}) bool

Contains returns true if an element is present in a slice

func DownloadFile

func DownloadFile(url, filepath string) error

DownloadFile will download a url and store it in local filepath. It writes to the destination file as it downloads it, without loading the entire file into memory. We pass an io.TeeReader into Copy() to report progress on the download.

func ExtractGameID

func ExtractGameID(fileName string) repository.GameID

ExtractGameID from fileName the id of game and version

func GetIPFromRequest added in v0.0.8

func GetIPFromRequest(r *http.Request) string

GetIPFromRequest returns ip from the request

func GetTitleMeta added in v0.2.1

func GetTitleMeta(titleID string) (string, bool, bool)

GetTitleMeta returns the BaseID of the content, as well as Update / DLC flags

func IsValidFilter added in v0.0.6

func IsValidFilter(filter string) bool

IsValidFilter returns true if the filter is handled

func Itob added in v0.0.8

func Itob(v uint64) []byte

Itob returns an 8-byte big endian representation of v.

func RemoveFileDesc

func RemoveFileDesc(s []repository.FileDesc, index int) []repository.FileDesc

RemoveFileDesc remove a specific index inside a repository.FileDesc

func RemoveGameFile

func RemoveGameFile(s []repository.GameFileType, index int) []repository.GameFileType

RemoveGameFile remove a specific index inside a repository.GameFileType

func Search(length int, f func(index int) bool) int

Search returns the index in an object

Types

This section is empty.

Jump to

Keyboard shortcuts

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