utils

package
v0.0.0-...-4b4c2ef Latest Latest
Warning

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

Go to latest
Published: May 9, 2024 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const AdminMsg = "static/locales/admin.json"

Variables

View Source
var Report embed.FS
View Source
var Static embed.FS

Functions

func Contains

func Contains(a []string, x string) bool

Contains tells whether a contains x.

func ConvertFromByte

func ConvertFromByte(data []byte, result interface{}) error

func ConvertFromReader

func ConvertFromReader(data io.Reader, result interface{}) error

func ConvertToByte

func ConvertToByte(data interface{}) ([]byte, error)

func ConvertToWriter

func ConvertToWriter(out io.Writer, data interface{}) error

func CreateToken

func CreateToken(username, database string, config map[string]interface{}) (result string, err error)

CreateToken - create/refresh a Nervatura JWT token

func Find

func Find(a []string, x string) int

Find returns the smallest index i at which x == a[i], or len(a) if there is no such index.

func GetHash

func GetHash(text string) string

func GetMessage

func GetMessage(key string) string

GetMessage - error messages

func ParseToken

func ParseToken(tokenString string, keyMap map[string]map[string]string, config map[string]interface{}) (map[string]interface{}, error)

ParseToken - Parse, validate, and return a token data.

func RandString

func RandString(length int) string

func SMAtoIMA

func SMAtoIMA(sRows []map[string]string) (iRows []map[string]interface{})

func StringToDateTime

func StringToDateTime(value string) (time.Time, error)

StringToDateTime - parse string to datetime

func ToBoolean

func ToBoolean(value interface{}, defValue bool) bool

ToBoolean - safe bool conversion

func ToFloat

func ToFloat(value interface{}, defValue float64) float64

ToFloat - safe float64 conversion

func ToIntPointer

func ToIntPointer(value interface{}, defValue int64) *int64

ToIntPointer - safe *int64 conversion

func ToInteger

func ToInteger(value interface{}, defValue int64) int64

ToInteger - safe int64 conversion

func ToRGBA

func ToRGBA(value interface{}, defValue color.RGBA) color.RGBA

ToRGBA - safe RGBA conversion

func ToString

func ToString(value interface{}, defValue string) string

ToString - safe string conversion

func ToStringPointer

func ToStringPointer(value interface{}, defValue string) *string

ToStringPointer - safe *string conversion

func TokenDecode

func TokenDecode(tokenString string) (map[string]interface{}, error)

TokenDecode - decoded JWT token but doesn't validate the signature.

Types

This section is empty.

Jump to

Keyboard shortcuts

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