utils

package
v0.0.0-...-0fbe63c Latest Latest
Warning

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

Go to latest
Published: May 2, 2025 License: GPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CommandRegex = regexp.MustCompile(`^/{1,2}`)
View Source
var FakePlayerRegex = regexp.MustCompile(`^\*fakeplayer\d+\*$`)
View Source
var MapFileRegex = regexp.MustCompile(`(?i)[.](Map|Challenge).*[.]Gbx$`)

Functions

func ChunkArray

func ChunkArray[T any](array []T, chunkSize int) [][]T

Splits an array into chunks of a specified size

func ConvertStringToType

func ConvertStringToType(value string) any

Converts a string to an appropriate type dynamically

func CreateFile

func CreateFile(file string, data any) error

Create file with data if it doesn't exist

func DecodeSlug

func DecodeSlug(slug string) string

Converts slugified base64 string back to a uuid

func ExportCSV

func ExportCSV(filePath string, data [][]string) error

ExportCSV exports data to a CSV file

func GetCurrentTimeInMilliseconds

func GetCurrentTimeInMilliseconds() int

Rreturns the current time as an integer (milliseconds since the Unix epoch)

func GetCurrentTimeInSeconds

func GetCurrentTimeInSeconds() int

Returns the current time as an integer (seconds since the Unix epoch)

func Includes

func Includes(slice any, value any) bool

Checks if an element is present in the slice

func MemoryChecker

func MemoryChecker(interval time.Duration)

Start checking memory every minute

func ProcessString

func ProcessString(str string) string

Processes a string and returns the modified string.

func ReadFile

func ReadFile[T any](file string) (T, error)

Read file and decode JSON data

func Remove

func Remove[T any](slice []T, value T) ([]T, bool)

Removes an element from a slice. Returns the new slice and a boolean indicating if the element was removed

func SetTheme

func SetTheme()

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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