Documentation
¶
Index ¶
- Constants
- Variables
- func CompareFiles(hash string, fileA string, fileB string) (bool, error)
- func CompareFilesKey(hash string, keyA []byte, fileA string, keyB []byte, fileB string) (bool, error)
- func DownloadDocument(url string, filePath string, client *http.Client) error
- func DownloadDocumentReturnHash(url string, filePath string, client *http.Client) (string, error)
- func GetContent(url string, client *http.Client) ([]byte, error)
- func GetMysql(user string, password string, host string, port string, dbName string) (string, string)
- func GetParsedContent(url string, client *http.Client) (*html.Node, error)
- func GetPostgres(host string, user string, password string, dbName string, port int, ...) (string, string)
- func GetSqlite(filePath string) (string, string)
- func HashData(hash string, data []byte) (string, error)
- func HashFile(hash string, filePath string) (string, error)
- func HashFileBuffer(hash string, filePath string, bufSize int) (string, error)
- func HashFileKey(hash string, key []byte, filePath string) (string, error)
- func HttpClient() *http.Client
- func LoadFileMultiple[S any](fileFormat string, file string, validation bool) ([]S, error)
- func LoadFileSingle[S any](fileFormat string, file string, validation bool) (S, error)
- func OnionClient() (*http.Client, error)
- func OpenEnv(tags ...string) []string
- func OpenEnvFilenames(filenames []string, tags ...string) []string
- type Database
- type DatabaseManager
- type FileFormatFactory
- type HashKeyFactory
Constants ¶
View Source
const ( KB = 1024 MB = KB * 1024 )
Variables ¶
View Source
var FileFormatRegistry = map[string]FileFormatFactory{ "json": json.Unmarshal, "yaml": yaml.Unmarshal, "toml": toml.Unmarshal, "xml": xml.Unmarshal, }
View Source
var Registry = map[string]func() hash.Hash{ "sha256": sha256.New, "sha384": sha512.New384, "sha512": sha512.New, "sha3-224": sha3.New224, "sha3-256": sha3.New256, "sha3-384": sha3.New384, "sha3-512": sha3.New512, "shake-128": func() hash.Hash { return &shakeAdapter{shake: sha3.NewShake128(), length: 32} }, "shake-256": func() hash.Hash { return &shakeAdapter{shake: sha3.NewShake256(), length: 64} }, }
View Source
var RegistryKey = map[string]HashKeyFactory{ "blake2b-256": func(key []byte) (hash.Hash, error) { return blake2b.New256(key) }, "blake2b-384": func(key []byte) (hash.Hash, error) { return blake2b.New384(key) }, "blake2b-512": func(key []byte) (hash.Hash, error) { return blake2b.New512(key) }, "blake2s-128": func(key []byte) (hash.Hash, error) { return blake2s.New128(key) }, "blake2s-256": func(key []byte) (hash.Hash, error) { return blake2s.New256(key) }, }
Legacy hash not supported yet.
Functions ¶
func CompareFilesKey ¶
func DownloadDocument ¶ added in v0.2.4
download a document give the url, the filepath where you want to store the document and the client
func DownloadDocumentReturnHash ¶
download a document and return its hash value
func GetContent ¶
Get the body of a webpage. Give the url and it will return the html body
func GetParsedContent ¶
Get the body and parse it. The package net/html allow to parse a html body into nodes to easily retrieve every html tags
func GetPostgres ¶ added in v0.2.4
func HashFileBuffer ¶
func LoadFileMultiple ¶ added in v0.2.4
The file content must represent an array/list of objects in the specified format
func LoadFileSingle ¶ added in v0.2.4
The file content must represent a single object in the specified format
func OpenEnvFilenames ¶
Merge several .env files and Return results in a slice of string
Types ¶
type Database ¶ added in v0.2.4
type Database struct { Dsn string Conn *sql.DB Driver string PingSuccess bool // contains filtered or unexported fields }
Default database manager
type DatabaseManager ¶ added in v0.2.4
type FileFormatFactory ¶ added in v0.2.4
Click to show internal directories.
Click to hide internal directories.