plugins

package
v1.16.1 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2023 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CachePackage added in v0.8.2

type CachePackage struct{}

CachePackage contains methods for use the cache (local or global)

func GetCache added in v0.8.2

func GetCache() *CachePackage

GetCache returns the FilePackage struct

func (*CachePackage) Get added in v0.8.2

func (c *CachePackage) Get(k string) *CacheResponse

Get return a cache item if it exists

func (*CachePackage) Put added in v0.8.2

func (c *CachePackage) Put(k, v string, ttl int64)

Put add a new value in the cache

type CacheResponse added in v0.8.2

type CacheResponse struct {
	Error  error
	Status bool
	Value  string
}

CacheResponse contains the return values

type FilePackage

type FilePackage struct{}

FilePackage contains file manipulation methods

func GetFile

func GetFile() *FilePackage

GetFile returns the FilePackage struct

func (*FilePackage) AppendString

func (c *FilePackage) AppendString(filename string, text string) FileResponse

AppendString opens the file in appending mode and write text on it

func (*FilePackage) Copy

func (c *FilePackage) Copy(src, dst string) FileResponse

Copy handles the copy of a file to another file

func (*FilePackage) Delete

func (c *FilePackage) Delete(filename string) FileResponse

Delete removes a file

func (*FilePackage) Exists

func (c *FilePackage) Exists(filename string) FileResponse

Exists returns true if the file exists

func (*FilePackage) Move

func (c *FilePackage) Move(src, dst string) FileResponse

Move renames a file

func (*FilePackage) Read added in v0.10.0

func (c *FilePackage) Read(fileName string) FileResponse

func (*FilePackage) Truncate

func (c *FilePackage) Truncate(filename string, size int64) FileResponse

Truncate set file length to size

func (*FilePackage) Write added in v0.10.0

func (c *FilePackage) Write(fileName string, data []byte) FileResponse

type FileResponse

type FileResponse struct {
	Error  error
	Status bool
	Binary []byte
	String string
}

FileResponse contains the return values

type HTTPPackage

type HTTPPackage struct{}

HTTPPackage contains all the methods to perform http requests

func GetHTTP

func GetHTTP() *HTTPPackage

GetHTTP returns the HTTPPackage

func (*HTTPPackage) DownloadFile

func (c *HTTPPackage) DownloadFile(filepath string, method string, uri string, headers interface{}, data interface{}) HTTPResponse

DownloadFile gets a file from an URL and store in on disk

func (*HTTPPackage) Get

func (c *HTTPPackage) Get(url string, headers map[string]string) HTTPResponse

Get performs a GET request

func (*HTTPPackage) Post

func (c *HTTPPackage) Post(url string, headers map[string]string, data interface{}) HTTPResponse

Post performs a POST request

func (*HTTPPackage) Request

func (c *HTTPPackage) Request(method string, uri string, headers interface{}, data interface{}) HTTPResponse

Request performs a HTTP request

func (*HTTPPackage) UploadFile

func (c *HTTPPackage) UploadFile(filename string, fieldname string, method string, uri string, headers interface{}, data interface{}) HTTPResponse

UploadFile sends a file to an URL

type HTTPResponse

type HTTPResponse struct {
	Error    error
	Response *http.Response
	Raw      []byte
	Body     string
	Status   bool
}

HTTPResponse contains the return values

type LogPackage

type LogPackage struct{}

LogPackage contains logs methods

func GetLog

func GetLog() *LogPackage

GetLog returns the LogPackage

func (*LogPackage) Debug

func (l *LogPackage) Debug(format string, a ...interface{})

Debug prints a debug line on the logs

func (*LogPackage) Error

func (l *LogPackage) Error(format string, a ...interface{})

Error prints an error line on the logs

func (*LogPackage) Info

func (l *LogPackage) Info(format string, a ...interface{})

Info prints an info line on the logs

type StringsPackage

type StringsPackage struct{}

StringsPackage contains string manipulation methods

func GetStrings

func GetStrings() *StringsPackage

GetStrings returns a StringsPackage

func (*StringsPackage) StartsWith

func (c *StringsPackage) StartsWith(str, substr string) StringsResponse

StartsWith returns true if a string start with a substring

type StringsResponse

type StringsResponse struct {
	Error  error
	Status bool
}

StringsResponse contains the return values

type UtilPackage

type UtilPackage struct{}

UtilPackage contains useful generic methods

func GetUtil

func GetUtil() *UtilPackage

GetUtil returns an UtilPackage

func (*UtilPackage) Getenv

func (c *UtilPackage) Getenv(name string) UtilResponse

Getenv returns an environment variable if it exists

func (*UtilPackage) Md5File added in v0.8.2

func (c *UtilPackage) Md5File(filename string) UtilResponse

Md5File returns the MD5 hash of the file

func (*UtilPackage) Sleep

func (c *UtilPackage) Sleep(seconds int) UtilResponse

Sleep call Sleep method for N seconds

type UtilResponse

type UtilResponse struct {
	Error  error
	Status bool
	Value  string
}

UtilResponse contains the return values

Jump to

Keyboard shortcuts

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