utils

package module
v0.0.0-...-dad75a0 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2025 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatUptime

func FormatUptime(dur time.Duration) string

Format Duration for Uptime

func GetMemory

func GetMemory() string

Get Memory of running golang process

func GetRandomInt

func GetRandomInt(min int, max int) int

Get Random Int (Min Inclusive->Max Exclusive)

func LoadEnv

func LoadEnv()

func NewDB

func NewDB(host, port, user, pass, dbName string) (*sql.DB, error)

func StartHTTPServer

func StartHTTPServer(ctx context.Context, port string, r http.Handler)

HTTP Server

func UploadFile

func UploadFile(ctx context.Context, url string, fpath string, formfield string) error

Upload File to URL

Types

type Credentials

type Credentials struct {
	User     string `json:"user"`     //Database Username
	Pass     string `json:"pass"`     //Database Pass
	Host     string `json:"host"`     //Database Host
	Port     string `json:"port"`     //Database Port
	Database string `json:"database"` //Database Table
}

Database credentials

func LoadCredentials

func LoadCredentials(path string) *Credentials

type ServerData

type ServerData struct {
	Name   string `json:"Name"`
	Memory string `json:"Memory"`
	Uptime string `json:"Uptime"`
}

Basic Server Data

Jump to

Keyboard shortcuts

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