codeutils

package module
v1.0.32 Latest Latest
Warning

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

Go to latest
Published: Dec 24, 2024 License: Apache-2.0 Imports: 21 Imported by: 2

Documentation

Overview

codeutils project codeutils.go See doc.go

codeutils document

Updated Dec 2024
v1.0.30

Index

Constants

View Source
const HOURLYLOG = 2
View Source
const MONTHLYLOG = 0
View Source
const WEEKLYLOG = 1

Variables

This section is empty.

Functions

func DateToStr added in v1.0.21

func DateToStr(adate time.Time) (result string)

func DecryptText added in v1.0.22

func DecryptText(password, encodedCiphertext string) (string, error)

DecryptText decrypts concatenated chunks and reassembles the plaintext.

func EncryptText added in v1.0.22

func EncryptText(password, plaintext string) (string, error)

encryptText encrypts the entire text in chunks and concatenates the results.

func FormatCommas added in v1.0.13

func FormatCommas(num int32) (formatedNum string)

func FormatFloatCommas added in v1.0.18

func FormatFloatCommas(num float64, digits int) (formatedNum string)

func FormatFloatCommasTrim added in v1.0.30

func FormatFloatCommasTrim(num float64, digits int) (formatedNum string)

func GetConfigValue

func GetConfigValue(configFile, name string) (value string)

func GetConfigValueWithError

func GetConfigValueWithError(configFile, name string) (value string, err error)

func GetConfigWithDefault added in v1.0.25

func GetConfigWithDefault(configFile, name, defaultValue string) (value string)

func GetCurrentAppDir

func GetCurrentAppDir() string

GetCurrentAppDir returns path from application running directory

func GetMD5 added in v1.0.9

func GetMD5(text string) string

func GetRandom added in v1.0.11

func GetRandom(r int) int

func GetRemoteIP added in v1.0.10

func GetRemoteIP(r *http.Request) (ip string)

func IsFileExists

func IsFileExists(fileName string) (exists bool)

func PrepareURLCall added in v1.0.13

func PrepareURLCall(url string, method string, content []byte) (req *http.Request, err error)

func ReadINIAsBool added in v1.0.27

func ReadINIAsBool(filename, section, key string) (value bool, err error)

func ReadINIAsInt added in v1.0.27

func ReadINIAsInt(filename, section, key string) (value int, err error)

func ReadINISections added in v1.0.27

func ReadINISections(filename string) (sections []string, err error)

func ReadINISectionsKeys added in v1.0.27

func ReadINISectionsKeys(filename, section string) (keys []string, err error)

func ReadINIValue added in v1.0.27

func ReadINIValue(filename, section, key, defaultValue string) (value string, err error)

func SetConfigValue

func SetConfigValue(configFile, name string, value string) (success bool)

func SetHeaderAuthentication added in v1.0.13

func SetHeaderAuthentication(req *http.Request, username, password string)

func SetIniValue added in v1.0.31

func SetIniValue(filename, section, key, value string) error

func SetLogType added in v1.0.6

func SetLogType(alogtype byte)

func SetURLHeaders added in v1.0.13

func SetURLHeaders(req *http.Request, headers map[string]string)

func SkipHTTPSVerfication added in v1.0.13

func SkipHTTPSVerfication()

func StrToDate added in v1.0.21

func StrToDate(dateStr string) (dateResult time.Time, err error)

func StrToTime added in v1.0.21

func StrToTime(timeStr string) (timeResult time.Time, err error)

func TimeToStr added in v1.0.21

func TimeToStr(atime time.Time) (result string)

func WriteToLog

func WriteToLog(event string, logFileName string) (err error)

WriteToLog write to log file

Types

type CallURLResult added in v1.0.14

type CallURLResult struct {
	Content    []byte
	StatusCode int
	Err        error
}

func CallURL added in v1.0.13

func CallURL(req *http.Request, timeoutSec int) (result CallURLResult)

func CallURLAsGet added in v1.0.13

func CallURLAsGet(url string, timeoutSec int) (result CallURLResult)

func CallURLAsPost added in v1.0.13

func CallURLAsPost(url string, contents []byte, timeoutSec int) (result CallURLResult)

Jump to

Keyboard shortcuts

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