app

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: May 18, 2025 License: CC0-1.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CombineFlags

func CombineFlags(flags []int) uint64

CombineFlags takes a slice of integers representing flag positions and combines them into a single uint64 bitmask.

Each integer in the input slice should be in the range [0, 63], representing a bit position in the 64-bit unsigned integer. The function sets the bit at each of these positions to 1 in the result.

For example, if flags = []int{0, 2, 5}, the result will have bits 0, 2, and 5 set, resulting in a value like: 0b00100101.

Any flag values outside the range [0, 63] are ignored.

Parameters:

  • flags: A slice of integers representing positions of individual flags.

Returns:

  • A uint64 value with the corresponding bits set.

func ComparePasswords

func ComparePasswords(storedHash, password string) error

ComparePasswords compares a plain password with a bcrypt hash

func EncryptPassword

func EncryptPassword(password string) (string, error)

EncryptPassword hashes a password and returns the hashed string along with any error

func IsValidDateStr

func IsValidDateStr(dateStr string) bool

func IsValidIso639_1

func IsValidIso639_1(languageStr string) bool

func ReadSVG

func ReadSVG(path string) string

func SqlNullBoolToBool

func SqlNullBoolToBool(nb sql.NullBool) bool

Utility function to extract bool from sql.NullBool

func SqlNullBoolToString

func SqlNullBoolToString(nb sql.NullBool) string

Utility function to extract string from sql.NullBool

func SqlNullInt64ToInt

func SqlNullInt64ToInt(n sql.NullInt64) int64

Utility function to extract int64 from sql.NullInt64

func SqlNullInt64ToString

func SqlNullInt64ToString(n sql.NullInt64) string

Utility function to extract string from sql.NullInt64

func SqlNullStringToString

func SqlNullStringToString(ns sql.NullString) string

Utility function to extract string from sql.NullString

func SqlNullTimeToString

func SqlNullTimeToString(nt sql.NullTime) string

Utility function to extract time from sql.NullTime

func TruncateAtWord

func TruncateAtWord(s string, maxLength int) string

TruncateAtWord truncates the string at the word boundary

Types

type Config

type Config struct {
	Verbose             bool     `json:"verbose"`
	DevMode             bool     `json:"dev_mode"`
	Port                int      `json:"port"`
	BaseApiUrl          string   `json:"base_api_url"`
	UseRouterMiddleware bool     `json:"use_router_middleware"`
	DbHost              string   `json:"db_host"`
	DbPort              int      `json:"db_port"`
	DbUser              string   `json:"db_user"`
	DbPassword          string   `json:"db_password"`
	DbName              string   `json:"db_name"`
	DbSchema            string   `json:"db_schema"`
	SSLMode             string   `json:"ssl_mode"`
	AllowOrigins        []string `json:"allow_origins"`
	PlutoVerbose        bool     `json:"pluto_verbose"`
	PlutoImageDir       string   `json:"pluto_image_dir"`
	PlutoCacheDir       string   `json:"pluto_cache_dir"`
}

Config holds database configuration details

func (Config) Print

func (config Config) Print()

type Uranus

type Uranus struct {
	MainDb        *pgxpool.Pool
	Config        Config
	SqlQueryEvent string
}
var Singleton *Uranus

func New

func New(configFilePath string) (*Uranus, error)

func (*Uranus) CloseAllDBs

func (app *Uranus) CloseAllDBs()

func (*Uranus) DbErrorToHTTP

func (app *Uranus) DbErrorToHTTP(err error) int

Function to convert database errors to HTTP status codes

func (*Uranus) InitMainDB

func (app *Uranus) InitMainDB() error

func (*Uranus) LoadConfig

func (app *Uranus) LoadConfig(fileName string) error

func (*Uranus) Log

func (app *Uranus) Log(msg string)

func (*Uranus) PrepareSql

func (app *Uranus) PrepareSql() error

Jump to

Keyboard shortcuts

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