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 ContainsAnyString(s string, substrs []string) bool
- func ContainsOnlyOneRune(s string, r rune) bool
- 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 FormatAmount(value int64) string
- func FormatTimezoneOffset(unixTime int64, timezone *time.Location) string
- func FormatTimezoneOffsetFromHoursOffset(hoursOffset string) (string, error)
- func FormatUnixTimeToLongDate(unixTime int64, timezone *time.Location) string
- func FormatUnixTimeToLongDateTime(unixTime int64, timezone *time.Location) string
- func FormatUnixTimeToLongDateTimeInServerTimezone(unixTime int64) string
- func FormatUnixTimeToLongDateTimeWithTimezone(unixTime int64, timezone *time.Location) string
- func FormatUnixTimeToLongDateTimeWithTimezoneRFC3339Format(unixTime int64, timezone *time.Location) string
- func FormatUnixTimeToLongDateTimeWithoutSecond(unixTime int64, timezone *time.Location) string
- func FormatUnixTimeToNumericLocalDateTime(unixTime int64, timezone *time.Location) int64
- func FormatUnixTimeToNumericYearMonth(unixTime int64, timezone *time.Location) int32
- func FormatUnixTimeToNumericYearMonthDay(unixTime int64, timezone *time.Location) int32
- func FormatUnixTimeToYearMonth(unixTime int64, timezone *time.Location) string
- func FormatYearMonthDayToLongDateTime(year string, month string, day string) (string, error)
- func GetDisplayErrorMessage(err *errs.Error) string
- func GetFileNameExtension(path string) string
- func GetFileNameWithoutExtension(path string) string
- func GetFirstLowerCharString(s string) string
- func GetImageContentType(fileExtension string) string
- func GetJsonErrorResult(err *errs.Error, path string) map[string]any
- 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 GetServerTimezoneOffsetMinutes() int16
- func GetStartOfDay(t time.Time) time.Time
- func GetTimezoneOffsetMinutes(unixTime int64, timezone *time.Location) int16
- func GetTransactionTimeRangeByYearMonth(year int32, month int32) (int64, int64, error)
- func GetUnixTimeFromTransactionTime(transactionTime int64) int64
- func Int64ArrayToStringArray(num []int64) []string
- func Int64SliceEquals(s1, s2 []int64) bool
- func Int64SliceMinus(s1, s2 []int64) []int64
- func Int64Sort(items []int64)
- func Int64ToString(num int64) string
- func IntToString(num int) string
- func IsExists(path string) (bool, error)
- func IsStringOnlyContainsDigits(str string) bool
- func IsUnixTimeEqualsYearAndMonth(unixTime int64, timezone *time.Location, year int32, month int32) bool
- func IsValidDayMonthYearLongOrShortDateFormat(date string) bool
- func IsValidEmail(email string) bool
- func IsValidHexRGBColor(color string) bool
- func IsValidLongDateFormat(date string) bool
- func IsValidLongDateTimeFormat(datetime string) bool
- func IsValidLongDateTimeWithoutSecondFormat(datetime string) bool
- func IsValidMonthDayYearLongOrShortDateFormat(date string) bool
- func IsValidNickName(nickname string) bool
- func IsValidUsername(username string) bool
- func IsValidYearMonthDayLongOrShortDateFormat(date string) bool
- func ListFileNamesWithPrefixAndSuffix(path string, prefix string, suffix string) []string
- func MD5Encode(data []byte) []byte
- func MD5EncodeToString(data []byte) string
- func ParseAmount(amount string) (int64, error)
- func ParseFirstConsecutiveNumber(str string) (string, bool)
- func ParseFromElapsedSeconds(elapsedSeconds int) (string, error)
- func ParseFromLongDateFirstTime(t string, utcOffset int16) (time.Time, error)
- func ParseFromLongDateLastTime(t string, utcOffset int16) (time.Time, error)
- func ParseFromLongDateTimeInFixedUtcOffset(t string, utcOffset int16) (time.Time, error)
- func ParseFromLongDateTimeInTimeZone(t string, timezone *time.Location) (time.Time, error)
- func ParseFromLongDateTimeToMaxUnixTime(t string) (time.Time, error)
- func ParseFromLongDateTimeToMinUnixTime(t string) (time.Time, error)
- func ParseFromLongDateTimeWithTimezone(t string) (time.Time, error)
- func ParseFromLongDateTimeWithTimezone2(t string) (time.Time, error)
- func ParseFromLongDateTimeWithTimezoneRFC3339Format(t string) (time.Time, error)
- func ParseFromLongDateTimeWithoutSecondInFixedUtcOffset(t string, utcOffset int16) (time.Time, error)
- func ParseFromShortDateTimeInFixedUtcOffset(t string, utcOffset int16) (time.Time, error)
- func ParseFromTimezoneOffset(tzOffset string) (*time.Location, error)
- func ParseNumericYearMonth(yearMonth string) (int32, int32, error)
- func PrintDataErrorResult(c *core.WebContext, contentType string, err *errs.Error)
- func PrintDataSuccessResult(c *core.WebContext, contentType string, fileName string, result []byte)
- func PrintJSONRPCErrorResult(c *core.WebContext, jsonRPCRequest *core.JSONRPCRequest, err *errs.Error)
- func PrintJSONRPCSuccessResult(c *core.WebContext, jsonRPCRequest *core.JSONRPCRequest, result any)
- func PrintJsonErrorResult(c *core.WebContext, err *errs.Error)
- func PrintJsonSuccessResult(c *core.WebContext, result any)
- func PrintObjectFields(obj any)
- func SetEventStreamHeader(c *core.WebContext)
- 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 ToSet(items []int64) map[int64]bool
- func ToUniqueInt64Slice(items []int64) []int64
- func TrimTrailingZerosInDecimal(num string) string
- func WriteEventStreamJsonErrorResult(c *core.WebContext, originalErr *errs.Error)
- func WriteEventStreamJsonSuccessResult(c *core.WebContext, result any)
- func WriteFile(path string, data []byte) error
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 ContainsAnyString ¶ added in v1.2.0
ContainsAnyString returns whether the specified string contains any string of sub string slice
func ContainsOnlyOneRune ¶ added in v0.6.0
ContainsOnlyOneRune returns the source string only contains one character
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 FormatAmount ¶ added in v0.6.0
FormatAmount returns a textual representation of amount
func FormatTimezoneOffset ¶
FormatTimezoneOffset returns "+/-HH:MM" format of timezone
func FormatTimezoneOffsetFromHoursOffset ¶ added in v0.6.0
FormatTimezoneOffsetFromHoursOffset returns "+/-HH:MM" format of timezone from hours offset
func FormatUnixTimeToLongDate ¶ added in v0.8.0
FormatUnixTimeToLongDate returns a textual representation of the unix time formatted by long date time format
func FormatUnixTimeToLongDateTime ¶ added in v0.5.0
FormatUnixTimeToLongDateTime returns a textual representation of the unix time formatted by long date time format
func FormatUnixTimeToLongDateTimeInServerTimezone ¶
FormatUnixTimeToLongDateTimeInServerTimezone returns a textual representation of the unix time formatted by long date time format
func FormatUnixTimeToLongDateTimeWithTimezone ¶ added in v0.10.0
FormatUnixTimeToLongDateTimeWithTimezone returns a textual representation of the unix time formatted by long date time with timezone format
func FormatUnixTimeToLongDateTimeWithTimezoneRFC3339Format ¶ added in v0.10.0
func FormatUnixTimeToLongDateTimeWithTimezoneRFC3339Format(unixTime int64, timezone *time.Location) string
FormatUnixTimeToLongDateTimeWithTimezoneRFC3339Format returns a textual representation of the unix time formatted by long date time with timezone RFC 3339 format
func FormatUnixTimeToLongDateTimeWithoutSecond ¶
FormatUnixTimeToLongDateTimeWithoutSecond returns a textual representation of the unix time formatted by long date time format (no second)
func FormatUnixTimeToNumericLocalDateTime ¶ added in v0.5.0
FormatUnixTimeToNumericLocalDateTime returns numeric year, month, day, hour, minute and second of specified unix time
func FormatUnixTimeToNumericYearMonth ¶ added in v0.5.0
FormatUnixTimeToNumericYearMonth returns numeric year and month of specified unix time
func FormatUnixTimeToNumericYearMonthDay ¶ added in v1.2.0
FormatUnixTimeToNumericYearMonthDay returns numeric year, month and day of specified unix time
func FormatUnixTimeToYearMonth ¶
FormatUnixTimeToYearMonth returns year and month of specified unix time
func FormatYearMonthDayToLongDateTime ¶ added in v0.10.0
func GetDisplayErrorMessage ¶ added in v1.2.0
GetDisplayErrorMessage returns the display error message for given error
func GetFileNameExtension ¶ added in v0.5.0
GetFileNameExtension returns the file extension without dot
func GetFileNameWithoutExtension ¶ added in v0.5.0
GetFileNameWithoutExtension returns the file name without extension
func GetFirstLowerCharString ¶
GetFirstLowerCharString returns the source string parameter, but makes the first character lower case
func GetImageContentType ¶ added in v0.5.0
GetImageContentType returns the content type of specified image file extension or returns empty when the file extension is not image or not supported
func GetJsonErrorResult ¶ added in v1.2.0
GetJsonErrorResult returns error response in json format
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 ¶ added in v0.5.0
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 ¶ added in v0.5.0
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 ¶ added in v0.2.0
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 GetServerTimezoneOffsetMinutes ¶ added in v0.5.0
func GetServerTimezoneOffsetMinutes() int16
GetServerTimezoneOffsetMinutes returns offset minutes of current server timezone
func GetStartOfDay ¶ added in v1.3.0
GetStartOfDay returns the start time of the day for the specified time
func GetTimezoneOffsetMinutes ¶
GetTimezoneOffsetMinutes returns offset minutes according specified timezone
func GetTransactionTimeRangeByYearMonth ¶ added in v0.5.0
GetTransactionTimeRangeByYearMonth returns the transaction time range by specified year and month
func GetUnixTimeFromTransactionTime ¶
GetUnixTimeFromTransactionTime returns unix time from the transaction time
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 Int64Sort ¶ added in v0.6.0
func Int64Sort(items []int64)
Int64Sort sorts the specified array with int64 items
func Int64ToString ¶
Int64ToString returns the textual representation of this number
func IntToString ¶ added in v0.2.0
IntToString returns the textual representation of this number
func IsStringOnlyContainsDigits ¶ added in v0.6.0
IsStringOnlyContainsDigits returns whether the specified string only contains digit characters
func IsUnixTimeEqualsYearAndMonth ¶ added in v0.4.0
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 IsValidDayMonthYearLongOrShortDateFormat ¶ added in v0.6.0
IsValidDayMonthYearLongOrShortDateFormat reports long date is valid format
func IsValidEmail ¶
IsValidEmail reports whether email is valid
func IsValidHexRGBColor ¶
IsValidHexRGBColor reports whether color is valid
func IsValidLongDateFormat ¶ added in v0.6.0
IsValidLongDateFormat reports long date is valid format
func IsValidLongDateTimeFormat ¶ added in v0.6.0
IsValidLongDateTimeFormat reports whether long date time is valid format
func IsValidLongDateTimeWithoutSecondFormat ¶ added in v0.6.0
IsValidLongDateTimeWithoutSecondFormat reports long date time without seconds is valid format
func IsValidMonthDayYearLongOrShortDateFormat ¶ added in v0.6.0
IsValidMonthDayYearLongOrShortDateFormat reports long date is valid format
func IsValidNickName ¶ added in v1.2.0
IsValidNickName reports whether user nick name is valid
func IsValidUsername ¶
IsValidUsername reports whether username is valid
func IsValidYearMonthDayLongOrShortDateFormat ¶ added in v0.6.0
IsValidYearMonthDayLongOrShortDateFormat reports long date is valid format
func ListFileNamesWithPrefixAndSuffix ¶ added in v0.3.0
ListFileNamesWithPrefixAndSuffix returns file name list which has specified prefix and suffix
func MD5EncodeToString ¶ added in v0.4.0
MD5EncodeToString returns a hashed string by md5
func ParseAmount ¶ added in v0.6.0
ParseAmount parses a textual representation of amount
func ParseFirstConsecutiveNumber ¶ added in v0.6.0
ParseFirstConsecutiveNumber returns the first consecutive number in the specified string
func ParseFromElapsedSeconds ¶ added in v0.4.0
func ParseFromLongDateFirstTime ¶ added in v0.8.0
ParseFromLongDateFirstTime parses a formatted string in long date format
func ParseFromLongDateLastTime ¶ added in v0.8.0
ParseFromLongDateLastTime parses a formatted string in long date format
func ParseFromLongDateTimeInFixedUtcOffset ¶ added in v1.3.0
ParseFromLongDateTimeInFixedUtcOffset parses a formatted string in long date time format
func ParseFromLongDateTimeInTimeZone ¶ added in v1.3.0
ParseFromLongDateTimeInTimeZone parses a formatted string in long date time format
func ParseFromLongDateTimeToMaxUnixTime ¶ added in v0.4.0
ParseFromLongDateTimeToMaxUnixTime parses a formatted string in long date time format to maximal unix time (the easternmost timezone)
func ParseFromLongDateTimeToMinUnixTime ¶ added in v0.4.0
ParseFromLongDateTimeToMinUnixTime parses a formatted string in long date time format to minimal unix time (the westernmost timezone)
func ParseFromLongDateTimeWithTimezone ¶ added in v0.6.0
ParseFromLongDateTimeWithTimezone parses a formatted string in long date time format
func ParseFromLongDateTimeWithTimezone2 ¶ added in v0.6.0
ParseFromLongDateTimeWithTimezone2 parses a formatted string in long date time format
func ParseFromLongDateTimeWithTimezoneRFC3339Format ¶ added in v0.10.0
ParseFromLongDateTimeWithTimezoneRFC3339Format parses a formatted string in long date time RFC 3378 format
func ParseFromLongDateTimeWithoutSecondInFixedUtcOffset ¶ added in v1.3.0
func ParseFromLongDateTimeWithoutSecondInFixedUtcOffset(t string, utcOffset int16) (time.Time, error)
ParseFromLongDateTimeWithoutSecondInFixedUtcOffset parses a formatted string in long date time format (no second) with fixed UTC offset
func ParseFromShortDateTimeInFixedUtcOffset ¶ added in v1.3.0
ParseFromShortDateTimeInFixedUtcOffset parses a formatted string in short date time format with fixed UTC offset
func ParseFromTimezoneOffset ¶
ParseFromTimezoneOffset parses a formatted string in timezone offset format
func ParseNumericYearMonth ¶ added in v0.5.0
ParseNumericYearMonth returns numeric year and month from textual content
func PrintDataErrorResult ¶
func PrintDataErrorResult(c *core.WebContext, contentType string, err *errs.Error)
PrintDataErrorResult writes error response in custom content type to current http context
func PrintDataSuccessResult ¶
func PrintDataSuccessResult(c *core.WebContext, contentType string, fileName string, result []byte)
PrintDataSuccessResult writes success response in custom content type to current http context
func PrintJSONRPCErrorResult ¶ added in v0.10.0
func PrintJSONRPCErrorResult(c *core.WebContext, jsonRPCRequest *core.JSONRPCRequest, err *errs.Error)
PrintJSONRPCErrorResult writes error response in JSON-RPC format to current http context
func PrintJSONRPCSuccessResult ¶ added in v0.10.0
func PrintJSONRPCSuccessResult(c *core.WebContext, jsonRPCRequest *core.JSONRPCRequest, result any)
PrintJSONRPCSuccessResult writes success response in JSON-RPC format to current http context
func PrintJsonErrorResult ¶
func PrintJsonErrorResult(c *core.WebContext, err *errs.Error)
PrintJsonErrorResult writes error response in json format to current http context
func PrintJsonSuccessResult ¶
func PrintJsonSuccessResult(c *core.WebContext, result any)
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 SetEventStreamHeader ¶ added in v0.9.0
func SetEventStreamHeader(c *core.WebContext)
SetEventStreamHeader sets the headers for event stream response
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 ¶ added in v0.2.0
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 ¶ added in v0.2.0
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 ToSet ¶ added in v0.6.0
ToSet returns a map where the keys are the items in the specified array
func ToUniqueInt64Slice ¶
ToUniqueInt64Slice returns a int64 array which does not have duplicated items
func TrimTrailingZerosInDecimal ¶ added in v0.6.0
TrimTrailingZerosInDecimal returns a textual number without trailing zeros in decimal
func WriteEventStreamJsonErrorResult ¶ added in v0.9.0
func WriteEventStreamJsonErrorResult(c *core.WebContext, originalErr *errs.Error)
func WriteEventStreamJsonSuccessResult ¶ added in v0.9.0
func WriteEventStreamJsonSuccessResult(c *core.WebContext, result any)
Types ¶
This section is empty.