mylib

package module
v2.2.3 Latest Latest
Warning

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

Go to latest
Published: May 6, 2024 License: MIT Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Aes256Decode added in v2.1.7

func Aes256Decode(cipherText string, encKey []byte, iv string) (string, error)

func Aes256Encode added in v2.1.7

func Aes256Encode(plaintext string, key []byte, iv string, blockSize int) string

func Base64DecStd

func Base64DecStd(data string) string

func Base64DecUrl

func Base64DecUrl(data string) string

func Base64EncStd

func Base64EncStd(data string) string

func Base64EncUrl

func Base64EncUrl(data string) string

func BytesToString

func BytesToString(data []byte) string

func Concat

func Concat(args ...string) string

func ContainsInt

func ContainsInt(i []int, e int) bool

func ContainsStr

func ContainsStr(s []string, e string) bool

func Copy

func Copy(srcFolder string, destFolder string) bool

func CounterZeroNumber

func CounterZeroNumber(length int) string

func DeriveKey added in v2.1.7

func DeriveKey(passphrase string, salt []byte) []byte

func GetMD5

func GetMD5(s string) string

func HttpClient

func HttpClient(p PHttp) *http.Client

HttpClient (time.Duration, time.Duration, bool)

func HttpDial

func HttpDial(url string, t time.Duration) error

HttpDial (string)

func HttpDial2 added in v2.1.5

func HttpDial2(url string, t time.Duration) bool

func InlinePrintingXML

func InlinePrintingXML(xmlString string) string

func PKCS5Padding added in v2.1.7

func PKCS5Padding(ciphertext []byte, blockSize int, after int) []byte

func RNG

func RNG(min int, max int) int

func ReadASingleValueInFile

func ReadASingleValueInFile(filename string, keyword string) string

func ReadGzFile

func ReadGzFile(filename string) ([]byte, error)

func ReadOnFile

func ReadOnFile(file string) string

func ReduceWords

func ReduceWords(words string, start int, length int) string

func RemoveTabAndEnter

func RemoveTabAndEnter(str string) string

func Shellout

func Shellout(command string) (string, string, error)

func Throw

func Throw(up Exception)

func WriteOnFile

func WriteOnFile(data string, file string, append bool, mode os.FileMode)

WriteOnFile function Args: 1. data = @string 2. file = @string 3. append = @boolean 4. mod = @string

Types

type Block

type Block struct {
	Try     func()
	Catch   func(Exception)
	Finally func()
}

func (Block) Do

func (tcf Block) Do()

type Exception

type Exception interface{}

type PHttp

type PHttp struct {
	Timeout            time.Duration
	KeepAlive          time.Duration
	IsDisableKeepAlive bool
	MaxIdleConns       int
	IdleConnTimeout    time.Duration
	DisableCompression bool
}

type Utils

type Utils struct {
	LogPath             string
	LogFullPath         string
	LogLevelInit        int
	LogName             string
	LogFileName         string
	LogOS               *os.File
	LogThread           string
	AccessLogFormat     string
	AccessLogTimeFormat string
	TimeZone            string
}

func InitLog

func InitLog(Log Utils) *Utils

func (*Utils) Get

func (l *Utils) Get(url string, headers map[string]string, transport PHttp) ([]byte, string, int, error)

func (*Utils) GetDate

func (l *Utils) GetDate(dateFormat string) string

func (*Utils) GetDateAdd

func (l *Utils) GetDateAdd(format string, day int, month int, year int) string

func (*Utils) GetDateTimeAdd

func (l *Utils) GetDateTimeAdd(init string, add int, dateFormat string) string

func (*Utils) GetFormatTime

func (l *Utils) GetFormatTime(layout string) string

func (*Utils) GetLogId

func (l *Utils) GetLogId() string

func (*Utils) GetStringPathLog

func (l *Utils) GetStringPathLog(logName string) string

Used to define a full path of a log

func (*Utils) GetTomorrow

func (l *Utils) GetTomorrow(day time.Duration) string

func (*Utils) GetTomorrowWithFormat

func (l *Utils) GetTomorrowWithFormat(day time.Duration, formatDate string) string

func (*Utils) GetUniqId

func (l *Utils) GetUniqId() string

func (*Utils) GetYesterday

func (l *Utils) GetYesterday(day time.Duration) string

func (*Utils) GetYesterdayWithFormat

func (l *Utils) GetYesterdayWithFormat(day time.Duration, formatDate string) string

func (*Utils) Post

func (l *Utils) Post(url string, headers map[string]string, body []byte, transport PHttp) ([]byte, string, int, error)

func (*Utils) SetUpLog

func (l *Utils) SetUpLog(Log Utils)

func (*Utils) Upload added in v2.0.5

func (l *Utils) Upload(url string, headers map[string]string, extraParams map[string]string, filepath string, timeout time.Duration)

func (*Utils) Write

func (l *Utils) Write(logName string, logLevel string, logMsg string)

Write method param : 1. @loglevel ( option : 'info', 'debug', & 'error' ) -> string 2. @logMsg ( a message string appear in a log file ) -> string

Jump to

Keyboard shortcuts

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