Documentation
¶
Index ¶
- func AreSlicesEqual[T comparable](slice1 []T, slice2 []T) bool
- func ConvertToBool(value interface{}) (bool, error)
- func ConvertToFloat64(value interface{}, defaultValue float64) (float64, error)
- func ConvertToInt64(value interface{}, defaultValue int64) (int64, error)
- func ConvertToString(value interface{}) string
- func ConvertToUint64(value interface{}, defaultValue uint64) (uint64, error)
- func DoesPathExist(path string) (bool, error)
- func IsMap(value interface{}) bool
- func IsNumber(value interface{}) bool
- func IsSlice(value interface{}) bool
- func SliceContains[T comparable](slice []T, element T) bool
- func SliceIndex[T comparable](slice []T, element T) int
- func SliceMax[T Number](slice []T) (T, error)
- func SliceMin[T Number](slice []T) (T, error)
- func SliceModify[T comparable](slice []T, modifier func(item T) T) bool
- func SliceReverse[T comparable](slice []T) []T
- type FileAsset
- type FileFilter
- type Number
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AreSlicesEqual ¶
func AreSlicesEqual[T comparable](slice1 []T, slice2 []T) bool
Check if 2 slices are equal or not. The slices are considered equal if and only if there are of same length, and elements at the same index in slices are equal. If any of the slice is `nil` will return a `false`.
func ConvertToBool ¶
Convert the given value represented as `interface{}` to boolean. Returns `false` if value is `nil`. Returns `true` if the value is numeric and not-zero, or if the value is `string` and represents a `bool`, or if the value is non-primitive.
func ConvertToFloat64 ¶
Convert the given value represented as `interface{}` to a `float64` value. Returns the `defaultValue` is the value is `nil`. Returns an `error` if the value cannot be cast to a number. For non-primitive values, the `defaultValue` is returned.
func ConvertToInt64 ¶
Convert the given value represented as `interface{}` to a `int64` value. Returns the `defaultValue` is the value is `nil`. Returns an `error` if the value cannot be cast to a number. For non-primitive values, the `defaultValue` is returned.
func ConvertToString ¶
func ConvertToString(value interface{}) string
Convert the given value represented as `interface{}` to its string representation.
func ConvertToUint64 ¶
Convert the given value represented as `interface{}` to a `uint64` value. Returns the `defaultValue` is the value is `nil`. Returns an `error` if the value cannot be cast to a number. For non-primitive values, the `defaultValue` is returned.
func DoesPathExist ¶
Check if a given path exists or not?
func IsMap ¶
func IsMap(value interface{}) bool
Check if value represents a `map` or not. Returns `false` if value is `nil`.
func IsNumber ¶
func IsNumber(value interface{}) bool
Check if value is a primitve number or not. Returns `false` if value is `nil`.
func IsSlice ¶
func IsSlice(value interface{}) bool
Check if value represents a slice or not. Returns `false` if value is `nil`.
func SliceContains ¶
func SliceContains[T comparable](slice []T, element T) bool
Check if the slice contains the given element or not. Returns `false` if the slice is `nil`, or empty or the element cannot be found.
func SliceIndex ¶
func SliceIndex[T comparable](slice []T, element T) int
Find the index of the given element in the slice. The functions returns `-1` if the slice is `nil` or empty or the element cannot be found.
func SliceMax ¶
Find the minimum value from the slice of numbers. Returns an `error` if the slice is nil, or is empty.
func SliceMin ¶
Find the minimum value from the slice of numbers. Returns an `error` if the slice is nil, or is empty.
func SliceModify ¶
func SliceModify[T comparable](slice []T, modifier func(item T) T) bool
Modify the slice using a modifier function. Each element of the slice is sent to the modifier, and the returned value is updated in the slice at same index. The method has no effect if the slice is `nil`.
func SliceReverse ¶
func SliceReverse[T comparable](slice []T) []T
Reverse a slice and return the same. If the slice is `nil` or has less than or equal to one element, no action is taken.
Types ¶
type FileAsset ¶
type FileAsset struct {
Id string `json:"id"` // the unique ID for this file
Name string `json:"name"` // name of this file
Path string `json:"path"` // path of this file
Extension string `json:"extension"` // extension extracted for this file
MimeType string `json:"mimeType"` // mime type base on extension of this file
IsFolder bool `json:"isFolder"` // whether the file is a folder or not
IsSymbolicLink bool `json:"isSymLink"` // whether the file is a symlink or not
Size uint64 `json:"size"` // size of file
Created int64 `json:"created"` // when was the file created
Modified int64 `json:"modified"` // when was the file last modified
}