utils

package
v0.5.3 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2024 License: AGPL-3.0 Imports: 18 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

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

ByteToMap returns a map from bytes

func ByteToUint64

func ByteToUint64(bytes []byte) uint64

ByteToUint64 return an uint64 from bytes

func Contains

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, bool)

ExtractGameID from fileName the id of game and version

func GetIPFromRequest

func GetIPFromRequest(r *http.Request) string

GetIPFromRequest returns ip from the request

func GetTitleMeta

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

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

func IsValidFilter

func IsValidFilter(filter string) bool

IsValidFilter returns true if the filter is handled

func Itob

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