utils

package
v0.0.0-...-c13048f Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const FILEPATH string = "./static/assets/images/"

FILEPATH is the path to the profile pictures

View Source
const STATICPATH string = "/static/assets/images/"

STATICPATH is the path to the static folder from the web server

Variables

This section is empty.

Functions

func CheckPicture

func CheckPicture(name string, resize bool) (string, error)

func DeleteUnused

func DeleteUnused(used []string) error

func GenerateOtp

func GenerateOtp(len int) string

GenerateOtp generates a random number of length len

func GenerateRandomString

func GenerateRandomString(len int) string

GenerateRandomString generates a random string of length len using the pool of characters provided

func GetAvatar

func GetAvatar(username string) (bytes.Buffer, error)

Uses the govatar library to generate an avatar for the user Since the gender of the user is not known, we use MALE as a placeholder default

func GetImage

func GetImage(name string) (bytes.Buffer, error)

func GetImageFile

func GetImageFile(name string) (image.Image, error)

Types

type Config

type Config struct {
	DbRefresh bool
}

Handles Feature Flags and such

func ReadConfig

func ReadConfig() Config

type Env

type Env struct {
	ConnString   string
	ListenAddr   string
	Mail         string
	MailPassword string
}

func ReadEnv

func ReadEnv() Env

Reads the .env file and returns an Env struct.

Jump to

Keyboard shortcuts

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