Documentation
¶
Index ¶
- Constants
- func CreateDir(dirPath string) error
- func DetectContentType(content []byte) (string, error)
- func FindAllString(re *regexp2.Regexp, s string) []string
- func InferContentTypeByPath(filename string) (string, error)
- func LoadJsonYaml(filedata []byte, holder any, contentType string) error
- func LoadJsonYamlFromFile(filename string, holder any, contentType string) error
- func RemoveElement[T comparable](slice []T, element T) []T
- func SearchInSlice[T comparable](slice []T, element T) bool
- func SearchStringInSlice(strings []string, search string) bool
- func ValidateURL(u string) bool
- func WriteFile(filePath string, data []byte) error
Constants ¶
View Source
const JSON = "json"
View Source
const XML = "xml"
View Source
const YAML = "yaml"
Variables ¶
This section is empty.
Functions ¶
func DetectContentType ¶
detects JSON/YAML content type. returns error if no match is found
func InferContentTypeByPath ¶
Infer content type based on URI/file path
func LoadJsonYaml ¶
Parses JSON/YAML file content into holder ptr based on contentType
func LoadJsonYamlFromFile ¶
Loads JSON/YAML file into holder ptr based on contentType Note: function assumes that user has already validated filename
func RemoveElement ¶
func RemoveElement[T comparable](slice []T, element T) []T
func SearchInSlice ¶
func SearchInSlice[T comparable](slice []T, element T) bool
func SearchStringInSlice ¶
Function to search for a string in a slice of strings
func ValidateURL ¶
ValidateURL checks if the provided URL is valid. Note it doesn't make request to the server.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.