lib

package
v0.0.0-...-3356bae Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2022 License: LGPL-2.1 Imports: 26 Imported by: 0

README

Here we put all the codebase we want ot use as library or general SDK.

Documentation

Index

Constants

View Source
const SHA256 = "SHA256"

Variables

This section is empty.

Functions

func CalculateDroneWeightLimit

func CalculateDroneWeightLimit(model dto.DroneModel) float64

func Checksum

func Checksum(algorithm string, data []byte) (checksum string, err error)

Checksum returns the checksum of some data, using a specified algorithm. It only returns an error when an invalid algorithm is used. The valid ones are SHA256

func ComputeDID

func ComputeDID(data string) (string, error)

func ConcatenateBytes

func ConcatenateBytes(data ...[]byte) []byte

ConcatenateBytes is useful for combining multiple arrays of bytes, especially for signatures or digests over multiple fields

func Contains

func Contains(arr []string, elem string) bool

func DeepCopy

func DeepCopy(v interface{}) (interface{}, error)

func FileExists

func FileExists(filename string) (bool, error)

func GenerateUUIDBytes

func GenerateUUIDBytes() []byte

GenerateUUIDBytes returns a UUID based on RFC 4122 returning the generated bytes

func GenerateUUIDFormatDate

func GenerateUUIDFormatDate() string

func GenerateUUIDStr

func GenerateUUIDStr() string

GenerateUUIDStr returns a UUID based on RFC 4122

func GetBoolOrDefault

func GetBoolOrDefault(value string, defaultVal bool) bool

GetBoolOrDefault Note that the method returns default value if the string cannot be parsed!

func GetEnvOrDefault

func GetEnvOrDefault(env, defaultVal string) string

func GetEnvOrError

func GetEnvOrError(key string) string

GetEnvOrError Check environment variable. If the environment variable does not exist, the panic function raised

func GetFilesByExt

func GetFilesByExt(root, ext string) []string

GetFilesByExt search recursively into the given root path, to seek the files that match the specified file extension

- root [string] ~ Root path to search in on

- ext [string] ~ File extension to look for

func GetFilesByName

func GetFilesByName(root, fileNeme string) []string

GetFilesByName search recursively into the given root path, to seek the files that match the specified file filename

- root [string] ~ Root path to search in on

- fileNeme [string] ~ File name to look for

func InitValidator

func InitValidator()

InitValidator Activate behavior to require all fields and adding new validators

func MapToSlice

func MapToSlice(dMap map[string]string) []string

func MkAccessToken

func MkAccessToken(data *dto.AccessTokenData, sigKey []byte, tkAge uint8) ([]byte, error)

MkAccessToken create a signed JTW token with the specified data. This could be used for authentication purpose by a middleware

func NormalizeString

func NormalizeString(text string, upper bool) string

func SliceToMap

func SliceToMap(slice []string, dMap map[string]string)

func TrimDoubleQuotes

func TrimDoubleQuotes(text string) string

func Unique

func Unique(input []interface{}) []interface{}

func UniqueStrings

func UniqueStrings(input []string) []string

func UpdateJSON

func UpdateJSON(request interface{}, stateDB interface{}) ([]byte, error)

func ValidateSerialNumberDrone

func ValidateSerialNumberDrone(serialNumber string) bool

func ValidateString

func ValidateString(data string, regexp string) bool

ValidateString validate a string given a regular expression

func ValidateStringCollection

func ValidateStringCollection(data []interface{}, regexp string) bool

ValidateStringCollection validate a string collection given a regular expression

Types

This section is empty.

Jump to

Keyboard shortcuts

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