helper

package
v0.0.0-...-7f33b96 Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2021 License: AGPL-3.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FindInSlice

func FindInSlice(slice []string, val string) (int, bool)

FindInSlice iterates over the slice and returns the position of the element if found

func GenerateRandomToken

func GenerateRandomToken(length int) string

GenerateRandomToken generates a token of the specified length

func GenerateSHA1

func GenerateSHA1(reader io.Reader) string

GenerateSHA1 generates a sha1 hash for the specified reader

func ObjectIDIntersect

func ObjectIDIntersect(a []primitive.ObjectID, b []primitive.ObjectID) bool

ObjectIDIntersect checks whether slice a contains any element of slice b vice versa

func ParseConfig

func ParseConfig(config string) infrastructure.Config

ParseConfig parses the config file into the config object

func ParseGatewayEnv

func ParseGatewayEnv() infrastructure.Config

ParseGatewayEnv parses the Gateway configuration from the environment

func ParseNodeEnv

func ParseNodeEnv() infrastructure.Config

ParseNodeEnv parses the config file into the config object

func ParsePrimitiveID

func ParsePrimitiveID(hex string) primitive.ObjectID

ParsePrimitiveID parses a given string hex to a primitive object id

func PathExists

func PathExists(path string) bool

PathExists checks if a given path is available on the filesystem

func ReadContent

func ReadContent(reader io.Reader) ([]byte, error)

ReadContent reads the content from a reader into a byte array

func ReadFile

func ReadFile(path string) (*os.File, error)

ReadFile reads a given file

func ReadFileAndContent

func ReadFileAndContent(path string) (*os.File, []byte, error)

ReadFileAndContent reads a given file and reads its content into a byte array

func ReadJSONFile

func ReadJSONFile(config string) (*json.Decoder, *os.File)

ReadJSONFile tries to open a specified config file

func RemoveID

RemoveID removes a given value from a given slice

func Thumbnail

func Thumbnail(file *os.File, thumbSize uint) (io.Reader, *th.Source)

Thumbnail creates a thumbnail from the passed file reader

func UniqueStrings

func UniqueStrings(slice []string) []string

UniqueStrings removes all duplicates from a string slice and returns the result

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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