Documentation ¶
Overview ¶
Exposes various utility functions for strings, generation of valid filenames and random ID strings, zipping files/directories, reading/writing images
Exposes various utility functions for strings, generation of valid filenames and random ID strings, zipping files/directories, reading/writing images
Exposes various utility functions for strings, generation of valid filenames and random ID strings, zipping files/directories, reading/writing images
Exposes various utility functions for strings, generation of valid filenames and random ID strings, zipping files/directories, reading/writing images
Example (MakeSaveableFileName) ¶
fmt.Println(MakeSaveableFileName("my roi")) fmt.Println(MakeSaveableFileName("Dust/Alteration")) fmt.Println(MakeSaveableFileName("I bet $100 this is cheese")) fmt.Println(MakeSaveableFileName("10% Ca/Fe & Coffee matrix?"))
Output: my roi Dust Alteration I bet 100 this is cheese 10% Ca Fe Coffee matrix
Index ¶
- Constants
- func Abs[T constraints.Integer](val T) T
- func AddFilesToZip(w *zip.Writer, basePath, baseInZip string)
- func AddItemsToSet[K comparable](keys []K, theSet map[K]bool)
- func ConvertIntSlice[T constraints.Integer, F constraints.Integer](from []F) []T
- func FilesEqual(aPath, bPath string) error
- func FixUserId(userId string) string
- func GetMapKeys[K comparable, V any](theMap map[K]V) []K
- func ImagesEqual(aPath, bPath string) error
- func ItemInSlice[T comparable](a T, list []T) bool
- func MakeSaveableFileName(name string) string
- func MakeScanImage(imgPath string, fileSize uint32, source protos.ScanImageSource, ...) *protos.ScanImage
- func RandStringBytesMaskImpr(n int) string
- func ReadFileLines(filePath string) ([]string, error)
- func ReadImageFile(path string) (image.Image, error)
- func RemoveItemFromSlice[T comparable](a T, list []T) []T
- func SendProtoBinary(w http.ResponseWriter, m protoreflect.ProtoMessage)
- func SendProtoJSON(w http.ResponseWriter, m protoreflect.ProtoMessage)
- func SlicesEqual[T comparable](listA []T, listB []T) bool
- func UnzipDirectory(src string, dest string, flattenPaths bool) ([]string, error)
- func WritePNGImageFile(pathPrefix string, img image.Image) error
- func ZipDirectory(dirPath string) ([]byte, error)
Examples ¶
Constants ¶
const PrettyPrintIndentForJSON = " "
PrettyPrintIndentForJSON Pretty-print indenting of JSON
Variables ¶
This section is empty.
Functions ¶
func Abs ¶
func Abs[T constraints.Integer](val T) T
func AddFilesToZip ¶
func AddItemsToSet ¶
func AddItemsToSet[K comparable](keys []K, theSet map[K]bool)
func ConvertIntSlice ¶
func ConvertIntSlice[T constraints.Integer, F constraints.Integer](from []F) []T
func FilesEqual ¶
func GetMapKeys ¶
func GetMapKeys[K comparable, V any](theMap map[K]V) []K
func ImagesEqual ¶
func ItemInSlice ¶
func ItemInSlice[T comparable](a T, list []T) bool
func MakeSaveableFileName ¶
MakeSaveableFileName - Given a name which may not be acceptable as a file name, generate a string for a file name that won't have issues. This replaces bad characters like slashes with spaces, etc
func MakeScanImage ¶
func MakeScanImage( imgPath string, fileSize uint32, source protos.ScanImageSource, purpose protos.ScanImagePurpose, associatedScanIds []string, originScanId string, originImageURL string, matchInfo *protos.ImageMatchTransform, img image.Image) *protos.ScanImage
func RandStringBytesMaskImpr ¶
func ReadFileLines ¶
ReadFileLines - Reads all lines in a file into a string array
func RemoveItemFromSlice ¶
func RemoveItemFromSlice[T comparable](a T, list []T) []T
func SendProtoBinary ¶
func SendProtoBinary(w http.ResponseWriter, m protoreflect.ProtoMessage)
func SendProtoJSON ¶
func SendProtoJSON(w http.ResponseWriter, m protoreflect.ProtoMessage)
func SlicesEqual ¶
func SlicesEqual[T comparable](listA []T, listB []T) bool
func UnzipDirectory ¶
func ZipDirectory ¶
ZipDirectory - zips a whole directory and its contents (NOT recursive!) See: https://golang.org/pkg/archive/zip/#example_Writer
Types ¶
This section is empty.