Documentation ¶
Index ¶
- func AESGCMDecrypt(key []byte, ciphertext []byte) ([]byte, error)
- func AESGCMEncrypt(key []byte, plainText []byte) ([]byte, error)
- func Clone(src, dst any) error
- func DecryptSecret(encyptedSecret string, key string) (string, error)
- func EncodePassword(password string, salt string) string
- func EncryptSecret(secret string, key string) (string, error)
- func Float64ToString(num float64) string
- func FormatTimezoneOffset(timezone *time.Location) string
- func FormatUnixTimeToLongDateTimeInServerTimezone(unixTime int64) string
- func FormatUnixTimeToLongDateTimeWithoutSecond(unixTime int64, timezone *time.Location) string
- func FormatUnixTimeToNumericLocalDateTime(unixTime int64, timezone *time.Location) int64
- func FormatUnixTimeToYearMonth(unixTime int64, timezone *time.Location) string
- func GetFirstLowerCharString(s string) string
- func GetGravatarUrl(email string) string
- func GetLocalIPAddresses() ([]net.IP, error)
- func GetLocalIPAddressesString() (string, error)
- func GetMaxTransactionTimeFromUnixTime(unixTime int64) int64
- func GetMaxUnixTimeWithSameLocalDateTime(unixTime int64, currentUtcOffset int16) int64
- func GetMinTransactionTimeFromUnixTime(unixTime int64) int64
- func GetMinUnixTimeWithSameLocalDateTime(unixTime int64, currentUtcOffset int16) int64
- func GetRandomInteger(max int) (int, error)
- func GetRandomNumberOrLetter(n int) (string, error)
- func GetRandomNumberOrLowercaseLetter(n int) (string, error)
- func GetRandomString(n int) (string, error)
- func GetTimezoneOffsetMinutes(timezone *time.Location) int16
- func GetTransactionTimeRangeByYearMonth(year int32, month int32) (int64, int64, error)
- func GetUnixTimeFromTransactionTime(transactionTime int64) int64
- func IdentReader(encoding string, input io.Reader) (io.Reader, error)
- func Int64ArrayToStringArray(num []int64) []string
- func Int64SliceEquals(s1, s2 []int64) bool
- func Int64SliceMinus(s1, s2 []int64) []int64
- func Int64ToString(num int64) string
- func IntToString(num int) string
- func IsExists(path string) (bool, error)
- func IsUnixTimeEqualsYearAndMonth(unixTime int64, timezone *time.Location, year int32, month int32) bool
- func IsValidEmail(email string) bool
- func IsValidHexRGBColor(color string) bool
- func IsValidUsername(username string) bool
- func ListFileNamesWithPrefixAndSuffix(path string, prefix string, suffix string) []string
- func MD5Encode(data []byte) []byte
- func MD5EncodeToString(data []byte) string
- func ParseFromElapsedSeconds(elapsedSeconds int) (string, error)
- func ParseFromLongDateTime(t string, utcOffset int16) (time.Time, error)
- func ParseFromLongDateTimeToMaxUnixTime(t string) (time.Time, error)
- func ParseFromLongDateTimeToMinUnixTime(t string) (time.Time, error)
- func ParseFromLongDateTimeWithoutSecond(t string, timezone *time.Location) (time.Time, error)
- func ParseFromShortDateTime(t string, utcOffset int16) (time.Time, error)
- func ParseFromTimezoneOffset(tzOffset string) (*time.Location, error)
- func PrintDataErrorResult(c *core.Context, contentType string, err *errs.Error)
- func PrintDataSuccessResult(c *core.Context, contentType string, fileName string, result []byte)
- func PrintJsonErrorResult(c *core.Context, err *errs.Error)
- func PrintJsonSuccessResult(c *core.Context, result any)
- func PrintObjectFields(obj any)
- func SetProxyUrl(transport *http.Transport, proxy string)
- func StringArrayToInt64Array(strs []string) ([]int64, error)
- func StringToFloat64(str string) (float64, error)
- func StringToInt(str string) (int, error)
- func StringToInt32(str string) (int32, error)
- func StringToInt64(str string) (int64, error)
- func StringTryToInt(str string, defaultValue int) int
- func StringTryToInt64(str string, defaultValue int64) int64
- func SubString(str string, start int, length int) string
- func ToUniqueInt64Slice(items []int64) []int64
- func WriteFile(path string, data []byte) error
- type CookieExtractor
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AESGCMDecrypt ¶
AESGCMDecrypt returns a decrypted string by aes-gcm
func AESGCMEncrypt ¶
AESGCMEncrypt returns a encrypted string by aes-gcm
func DecryptSecret ¶
DecryptSecret returns a decrypted secret
func EncodePassword ¶
EncodePassword returns a encoded password
func EncryptSecret ¶
EncryptSecret returns a encrypted secret
func Float64ToString ¶
Float64ToString returns the textual representation of this number
func FormatTimezoneOffset ¶
FormatTimezoneOffset returns "+/-HH:MM" format of timezone
func FormatUnixTimeToLongDateTimeInServerTimezone ¶
FormatUnixTimeToLongDateTimeInServerTimezone returns a textual representation of the unix time formatted by long date time format
func FormatUnixTimeToLongDateTimeWithoutSecond ¶
FormatUnixTimeToLongDateTimeWithoutSecond returns a textual representation of the unix time formatted by long date time format (no second)
func FormatUnixTimeToNumericLocalDateTime ¶
FormatUnixTimeToNumericLocalDateTime returns numeric year, month, day, hour, minute and second of specified unix time
func FormatUnixTimeToYearMonth ¶
FormatUnixTimeToYearMonth returns year and month of specified unix time
func GetFirstLowerCharString ¶
GetFirstLowerCharString returns the source string parameter, but makes the first character lower case
func GetGravatarUrl ¶
GetGravatarUrl returns the Gravatar url according to the specified user email address
func GetLocalIPAddresses ¶
GetLocalIPAddresses returns all local ip address object array
func GetLocalIPAddressesString ¶
GetLocalIPAddressesString returns all local ip address, every ip split by comma
func GetMaxTransactionTimeFromUnixTime ¶
GetMaxTransactionTimeFromUnixTime returns the maximum transaction time from unix time
func GetMaxUnixTimeWithSameLocalDateTime ¶
GetMaxUnixTimeWithSameLocalDateTime returns the maximum UnixTime for date with the same local date
func GetMinTransactionTimeFromUnixTime ¶
GetMinTransactionTimeFromUnixTime returns the minimum transaction time from unix time
func GetMinUnixTimeWithSameLocalDateTime ¶
GetMinUnixTimeWithSameLocalDateTime returns the minimum UnixTime for date with the same local date
func GetRandomInteger ¶
GetRandomInteger returns a random number, the max parameter represents upper limit
func GetRandomNumberOrLetter ¶
GetRandomNumberOrLetter returns a random string which only contains number or letter characters
func GetRandomNumberOrLowercaseLetter ¶
GetRandomNumberOrLowercaseLetter returns a random string which only contains number or letter characters
func GetRandomString ¶
GetRandomString returns a random string of which length is n
func GetTimezoneOffsetMinutes ¶
GetTimezoneOffsetMinutes returns offset minutes according specified timezone
func GetTransactionTimeRangeByYearMonth ¶
GetTransactionTimeRangeByYearMonth returns the transaction time range by specified year and month
func GetUnixTimeFromTransactionTime ¶
GetUnixTimeFromTransactionTime returns unix time from the transaction time
func IdentReader ¶
IdentReader returns the original io reader
func Int64ArrayToStringArray ¶
Int64ArrayToStringArray returns a array of textual representation of these numbers
func Int64SliceEquals ¶
Int64SliceEquals returns whether specific two int64 arrays equal
func Int64SliceMinus ¶
Int64SliceMinus returns a int64 array which contains items in s1 but not in s2
func Int64ToString ¶
Int64ToString returns the textual representation of this number
func IntToString ¶
IntToString returns the textual representation of this number
func IsUnixTimeEqualsYearAndMonth ¶
func IsUnixTimeEqualsYearAndMonth(unixTime int64, timezone *time.Location, year int32, month int32) bool
IsUnixTimeEqualsYearAndMonth returns whether year and month of the unix time are equals to the specified year and month
func IsValidEmail ¶
IsValidEmail reports whether email is valid
func IsValidHexRGBColor ¶
IsValidHexRGBColor reports whether color is valid
func IsValidUsername ¶
IsValidUsername reports whether username is valid
func ListFileNamesWithPrefixAndSuffix ¶
ListFileNamesWithPrefixAndSuffix returns file name list which has specified prefix and suffix
func MD5EncodeToString ¶
MD5EncodeToString returns a hashed string by md5
func ParseFromElapsedSeconds ¶
func ParseFromLongDateTime ¶
ParseFromLongDateTime parses a formatted string in long date time format
func ParseFromLongDateTimeToMaxUnixTime ¶
ParseFromLongDateTimeToMaxUnixTime parses a formatted string in long date time format to maximal unix time (the easternmost timezone)
func ParseFromLongDateTimeToMinUnixTime ¶
ParseFromLongDateTimeToMinUnixTime parses a formatted string in long date time format to minimal unix time (the westernmost timezone)
func ParseFromLongDateTimeWithoutSecond ¶
ParseFromLongDateTimeWithoutSecond parses a formatted string in long date time format (no second)
func ParseFromShortDateTime ¶
ParseFromShortDateTime parses a formatted string in short date time format
func ParseFromTimezoneOffset ¶
ParseFromTimezoneOffset parses a formatted string in timezone offset format
func PrintDataErrorResult ¶
PrintDataErrorResult writes error response in custom content type to current http context
func PrintDataSuccessResult ¶
PrintDataSuccessResult writes success response in custom content type to current http context
func PrintJsonErrorResult ¶
PrintJsonErrorResult writes error response in json format to current http context
func PrintJsonSuccessResult ¶
PrintJsonSuccessResult writes success response in json format to current http context
func PrintObjectFields ¶
func PrintObjectFields(obj any)
PrintObjectFields prints all fields in specified object
func SetProxyUrl ¶
SetProxyUrl sets proxy url to http transport according to specified proxy setting
func StringArrayToInt64Array ¶
StringArrayToInt64Array parses a series textual representations of the numbers to int64 array
func StringToFloat64 ¶
StringToFloat64 parses a textual representation of the number to float64
func StringToInt ¶
StringToInt parses a textual representation of the number to int
func StringToInt32 ¶
StringToInt32 parses a textual representation of the number to int32
func StringToInt64 ¶
StringToInt64 parses a textual representation of the number to int64
func StringTryToInt ¶
StringTryToInt parses a textual representation of the number to int if str is valid, or returns the default value
func StringTryToInt64 ¶
StringTryToInt64 parses a textual representation of the number to int64 if str is valid, or returns the default value
func ToUniqueInt64Slice ¶
ToUniqueInt64Slice returns a int64 array which does not have duplicated items
Types ¶
type CookieExtractor ¶
type CookieExtractor []string
CookieExtractor extracts a token from request cookies
func (CookieExtractor) ExtractToken ¶
func (e CookieExtractor) ExtractToken(req *http.Request) (string, error)