Documentation
¶
Index ¶
- Constants
- Variables
- func AlignNextTime(base time.Time, interval time.Duration, offset time.Duration) time.Time
- func Base64Decode(enc *base64.Encoding, data []byte) ([]byte, error)
- func Base64Encode(enc *base64.Encoding, data []byte) []byte
- func DayOf(t time.Time) time.Time
- func DereferenceReflectPointer(ptr reflect.Value) (result reflect.Value, ok bool)
- func DereferenceReflectPointerWithError(ptr reflect.Value) (result reflect.Value, err error)
- func Friday(t time.Time) time.Time
- func GenerateRsaKey(bits int) (publicKey, privateKey []byte, err error)
- func GetYear2050() time.Time
- func GetYear3000() time.Time
- func GetYear5000() time.Time
- func Gunzip(data []byte) ([]byte, error)
- func Gzip(data []byte) ([]byte, error)
- func HashData(hash crypto.Hash, datas ...[]byte) ([]byte, error)
- func HashDataSilently(hash crypto.Hash, datas ...[]byte) []byte
- func HashSum(hash hash.Hash, data []byte) []byte
- func HashSumBtob(hash hash.Hash, data []byte) []byte
- func HashSumBtos(hash hash.Hash, data []byte) string
- func HashSumStob(hash hash.Hash, data string) []byte
- func HashSumStos(hash hash.Hash, data string) string
- func IteratorDataToTypelessSliceByReflect(data any) ([]any, error)
- func IteratorDataToTypelessSliceByReflectValue(data reflect.Value) ([]any, error)
- func MapKeyValuePairPtrsByReflect(m any) (stl.KeyValuePairPtrs[any, any], error)
- func MapKeyValuePairPtrsByReflectValue(m reflect.Value) stl.KeyValuePairPtrs[any, any]
- func MapKeyValuePairsByReflect(m any) (stl.KeyValuePairs[any, any], error)
- func MapKeyValuePairsByReflectValue(m reflect.Value) stl.KeyValuePairs[any, any]
- func MapListByReflect[T any](datas any, mapper func(data any) T) ([]T, error)
- func MapListByReflectValue[T any](datas reflect.Value, mapper func(data any) T) []T
- func MapListToAnysByReflect(datas any) ([]any, error)
- func MapListToAnysByReflectValue(datas reflect.Value) []any
- func MapMapWithReflect[T any](m any, mapper func(stl.KeyValuePair[any, any]) T) ([]T, error)
- func MapMapWithReflectValue[T any](m reflect.Value, mapper func(stl.KeyValuePair[any, any]) T) []T
- func MaxTime(times ...time.Time) time.Time
- func MinTime(times ...time.Time) time.Time
- func Monday(t time.Time) time.Time
- func NewHash(hash crypto.Hash) (hash.Hash, error)
- func NewTimes(times ...time.Time) []time.Time
- func NextWeekday(t time.Time, weekday time.Weekday) time.Time
- func PanicRecover(panicError *error, onPanicErrors ...func(*PanicError)) error
- func ParseJsonRawMessage[Data any](message JsonRawMessage) (data Data, err error)
- func ParseJsonRawMessageAsPointer[Ptr *Data, Data any](message JsonRawMessage) (Ptr, error)
- func ParseNetloc(loc string, defaultAddr string, defaultPort int) (addr string, port int, err error)
- func Pkcs5Padding(data []byte, blockSize int) []byte
- func Pkcs5Unpadding(data []byte) []byte
- func Saturday(t time.Time) time.Time
- func SortTimes(times ...time.Time) []time.Time
- func StdBase64Decode(data []byte) ([]byte, error)
- func StdBase64Encode(data []byte) []byte
- func StringToBytes(s string) []byte
- func Sunday(t time.Time) time.Time
- func Thursday(t time.Time) time.Time
- func Today() time.Time
- func Tomorrow() time.Time
- func Tuesday(t time.Time) time.Time
- func UrlBase64Decode(data []byte) ([]byte, error)
- func UrlBase64Encode(data []byte) []byte
- func Wednesday(t time.Time) time.Time
- func WeekdayOf(t time.Time, weekday time.Weekday) time.Time
- func WrapTimeFields(data any, wrapper func(time.Time) time.Time) error
- func WrapTimeFieldsByReflectValue(value reflect.Value, wrapper func(time.Time) time.Time) error
- func Yesterday() time.Time
- type AesCipher
- type BadTypeError
- func (e BadTypeError) Error() string
- func (err BadTypeError) WithExpected(expected string) BadTypeError
- func (err BadTypeError) WithExpectedReflectType(expected reflect.Type) BadTypeError
- func (err BadTypeError) WithGiven(given string) BadTypeError
- func (err BadTypeError) WithGivenReflectType(given reflect.Type) BadTypeError
- type Closers
- type CookieNotFoundError
- type DateTime
- type EnvironmentVariableNotFoundError
- type Errors
- type GenericNotFoundError
- type HashPro
- type Hasher
- func (hasher Hasher) New() hash.Hash
- func (hasher Hasher) NewHashPro() *HashPro
- func (hasher Hasher) Sum(data []byte) []byte
- func (hasher Hasher) SumBstob(datas [][]byte) []byte
- func (hasher Hasher) SumBstobX(datas ...[]byte) []byte
- func (hasher Hasher) SumBstos(datas [][]byte) string
- func (hasher Hasher) SumBstosX(datas ...[]byte) string
- func (hasher Hasher) SumBtob(data []byte) []byte
- func (hasher Hasher) SumBtos(data []byte) string
- func (hasher Hasher) SumReader(reader io.Reader) []byte
- func (hasher Hasher) SumRtob(reader io.Reader) []byte
- func (hasher Hasher) SumRtos(reader io.Reader) string
- func (hasher Hasher) SumSstob(datas []string) []byte
- func (hasher Hasher) SumSstobX(datas ...string) []byte
- func (hasher Hasher) SumSstos(datas []string) string
- func (hasher Hasher) SumSstosX(datas ...string) string
- func (hasher Hasher) SumStob(data string) []byte
- func (hasher Hasher) SumStos(data string) string
- type IntraDayTime
- type IntraDayTimes
- type JsonAny
- type JsonArray
- type JsonMap
- type JsonObject
- type JsonRawMessage
- type JsonRawMessageMap
- type JsonRawStrMessage
- type ListIteratorByReflect
- type MapIteratorByReflect
- type NilError
- type NotImplementedError
- type PanicError
- type PrivateKeyCipher
- func (c *PrivateKeyCipher) Decrypt(ciphertext []byte) ([]byte, error)
- func (c *PrivateKeyCipher) DecryptPro(ciphertext []byte, decrypter RsaDecrypter, random io.Reader) ([]byte, error)
- func (c *PrivateKeyCipher) Sign(data []byte) ([]byte, error)
- func (c *PrivateKeyCipher) SignPro(data []byte, signer RsaSigner, random io.Reader, hash crypto.Hash) ([]byte, error)
- type PublicKeyCipher
- func (c *PublicKeyCipher) Encrypt(plaintext []byte) ([]byte, error)
- func (c *PublicKeyCipher) EncryptPro(plaintext []byte, encrypter RsaEncrypter, random io.Reader) ([]byte, error)
- func (c *PublicKeyCipher) Verify(data, sign []byte) error
- func (c *PublicKeyCipher) VerifyPro(data, sign []byte, verifier RsaVerifier, hash crypto.Hash) error
- type RsaDecrypter
- type RsaEncrypter
- type RsaSigner
- type RsaVerifier
- type SpillBuffer
Constants ¶
View Source
const ( DurationDay = time.Hour * 24 DurationMonth = DurationDay * 30 MaxDurationMonth = DurationDay * 31 DurationYear = DurationDay * 365 MaxDurationYear = DurationDay * 366 )
View Source
const (
SpillBufferMemoryWaterMark = 1024 * 1024 * 1 // 1MB 内存水位线
)
Variables ¶
View Source
var ReflectTimeType = stl.ReflectType[time.Time]()
View Source
var StdBase64DecodeString = base64.StdEncoding.DecodeString
View Source
var StdBase64EncodeToString = base64.StdEncoding.EncodeToString
View Source
var UrlBase64DecodeString = base64.URLEncoding.DecodeString
View Source
var UrlBase64EncodeToString = base64.URLEncoding.EncodeToString
Functions ¶
func AlignNextTime ¶ added in v1.0.8
func Base64Decode ¶ added in v1.0.6
func DereferenceReflectPointer ¶ added in v1.0.35
func DereferenceReflectPointerWithError ¶ added in v1.0.35
func GenerateRsaKey ¶ added in v1.0.6
func HashDataSilently ¶ added in v1.0.6
func IteratorDataToTypelessSliceByReflect ¶ added in v1.0.35
func IteratorDataToTypelessSliceByReflectValue ¶ added in v1.0.35
func MapKeyValuePairPtrsByReflect ¶ added in v1.0.35
func MapKeyValuePairPtrsByReflectValue ¶ added in v1.0.35
func MapKeyValuePairsByReflect ¶ added in v1.0.35
func MapKeyValuePairsByReflectValue ¶ added in v1.0.35
func MapListByReflect ¶ added in v1.0.35
func MapListByReflectValue ¶ added in v1.0.35
func MapListToAnysByReflect ¶ added in v1.0.35
func MapListToAnysByReflectValue ¶ added in v1.0.35
func MapMapWithReflect ¶ added in v1.0.35
func MapMapWithReflectValue ¶ added in v1.0.35
func PanicRecover ¶ added in v1.0.69
func PanicRecover(panicError *error, onPanicErrors ...func(*PanicError)) error
func ParseJsonRawMessage ¶ added in v1.0.24
func ParseJsonRawMessage[Data any](message JsonRawMessage) (data Data, err error)
func ParseJsonRawMessageAsPointer ¶ added in v1.0.24
func ParseJsonRawMessageAsPointer[Ptr *Data, Data any](message JsonRawMessage) (Ptr, error)
func ParseNetloc ¶ added in v1.0.11
func Pkcs5Padding ¶ added in v1.0.6
func Pkcs5Unpadding ¶ added in v1.0.6
func StdBase64Decode ¶ added in v1.0.72
func StdBase64Encode ¶ added in v1.0.72
func UrlBase64Decode ¶ added in v1.0.72
func UrlBase64Encode ¶ added in v1.0.72
func WrapTimeFields ¶ added in v1.0.48
func WrapTimeFieldsByReflectValue ¶ added in v1.0.48
Types ¶
type AesCipher ¶ added in v1.0.6
type AesCipher struct {
// contains filtered or unexported fields
}
type BadTypeError ¶ added in v1.0.35
type BadTypeError struct {
// contains filtered or unexported fields
}
func NewBadTypeError ¶ added in v1.0.35
func NewBadTypeError(expected, given string) BadTypeError
func NewBadTypeErrorWithGivenReflectType ¶ added in v1.0.35
func NewBadTypeErrorWithGivenReflectType(expected, given reflect.Type) BadTypeError
func NewBlankBadTypeError ¶ added in v1.0.35
func NewBlankBadTypeError() BadTypeError
func (BadTypeError) Error ¶ added in v1.0.35
func (e BadTypeError) Error() string
func (BadTypeError) WithExpected ¶ added in v1.0.35
func (err BadTypeError) WithExpected(expected string) BadTypeError
func (BadTypeError) WithExpectedReflectType ¶ added in v1.0.35
func (err BadTypeError) WithExpectedReflectType(expected reflect.Type) BadTypeError
func (BadTypeError) WithGiven ¶ added in v1.0.35
func (err BadTypeError) WithGiven(given string) BadTypeError
func (BadTypeError) WithGivenReflectType ¶ added in v1.0.35
func (err BadTypeError) WithGivenReflectType(given reflect.Type) BadTypeError
type Closers ¶ added in v1.0.88
func NewClosers ¶ added in v1.0.88
type CookieNotFoundError ¶
type CookieNotFoundError struct {
// contains filtered or unexported fields
}
func NewCookieNotFoundError ¶
func NewCookieNotFoundError(name string) CookieNotFoundError
func (CookieNotFoundError) Error ¶
func (e CookieNotFoundError) Error() string
func (CookieNotFoundError) Name ¶
func (e CookieNotFoundError) Name() string
type DateTime ¶ added in v1.0.77
func (DateTime) MarshalJSON ¶ added in v1.0.77
func (*DateTime) UnmarshalJSON ¶ added in v1.0.77
type EnvironmentVariableNotFoundError ¶
type EnvironmentVariableNotFoundError struct {
// contains filtered or unexported fields
}
func NewEnvironmentVariableNotFoundError ¶
func NewEnvironmentVariableNotFoundError(name string) EnvironmentVariableNotFoundError
func (EnvironmentVariableNotFoundError) Error ¶
func (e EnvironmentVariableNotFoundError) Error() string
func (EnvironmentVariableNotFoundError) Name ¶
func (e EnvironmentVariableNotFoundError) Name() string
type Errors ¶ added in v1.0.8
func ReflectMap ¶ added in v1.0.71
func ReflectMap(datas any, methodName string, methodOutValueIndex, methodOutErrorIndex int, args []reflect.Value, stopWhenError bool) (values any, errs Errors, err error)
ReflectMap traverses elements in datas, calls the specified method on each element, and returns the results as a slice.
Parameters: - datas: a slice or array of data to process - methodName: the name of the method to call on each element - methodOutValueIndex: the index of the value returned by the method - methodOutErrorIndex: the index of the error returned by the method - args: additional arguments to pass to the method (can be empty) - stopWhenError: whether to stop processing when an error occurs
Returns: - values: a slice containing the values returned by the method calls - error: the first error encountered, or nil if no errors occurred
type GenericNotFoundError ¶ added in v1.0.25
type GenericNotFoundError struct {
// contains filtered or unexported fields
}
func NewGenericNotFoundError ¶ added in v1.0.25
func NewGenericNotFoundError(t, name string) GenericNotFoundError
func (GenericNotFoundError) Error ¶ added in v1.0.25
func (e GenericNotFoundError) Error() string
func (GenericNotFoundError) Name ¶ added in v1.0.25
func (e GenericNotFoundError) Name() string
func (GenericNotFoundError) Type ¶ added in v1.0.25
func (e GenericNotFoundError) Type() string
type HashPro ¶ added in v1.0.80
func NewHashPro ¶ added in v1.0.80
type Hasher ¶ added in v1.0.80
func GetMd5Hasher ¶ added in v1.0.80
func GetMd5Hasher() Hasher
func GetSha1Hasher ¶ added in v1.0.80
func GetSha1Hasher() Hasher
func GetSha224Hasher ¶ added in v1.0.80
func GetSha224Hasher() Hasher
func GetSha256Hasher ¶ added in v1.0.80
func GetSha256Hasher() Hasher
func GetSha512Hasher ¶ added in v1.0.80
func GetSha512Hasher() Hasher
func (Hasher) NewHashPro ¶ added in v1.0.80
type IntraDayTime ¶ added in v1.0.58
func MustParseFormattedIntraDayTime ¶ added in v1.0.58
func MustParseFormattedIntraDayTime(layout, value string) IntraDayTime
func MustParseIntraDayTime ¶ added in v1.0.58
func MustParseIntraDayTime(s string) IntraDayTime
func ParseFormattedIntraDayTime ¶ added in v1.0.58
func ParseFormattedIntraDayTime(layout, value string) (IntraDayTime, error)
func ParseIntraDayTime ¶ added in v1.0.58
func ParseIntraDayTime(s string) (IntraDayTime, error)
func (IntraDayTime) Duration ¶ added in v1.0.58
func (t IntraDayTime) Duration() time.Duration
func (IntraDayTime) Format ¶ added in v1.0.58
func (t IntraDayTime) Format(layout string) string
func (IntraDayTime) MarshalJSON ¶ added in v1.0.58
func (t IntraDayTime) MarshalJSON() ([]byte, error)
func (IntraDayTime) String ¶ added in v1.0.58
func (t IntraDayTime) String() string
func (*IntraDayTime) UnmarshalJSON ¶ added in v1.0.58
func (t *IntraDayTime) UnmarshalJSON(data []byte) error
type IntraDayTimes ¶ added in v1.1.4
type IntraDayTimes []IntraDayTime
func (IntraDayTimes) Empty ¶ added in v1.1.4
func (ts IntraDayTimes) Empty() bool
func (IntraDayTimes) Len ¶ added in v1.1.4
func (ts IntraDayTimes) Len() int
func (IntraDayTimes) Sort ¶ added in v1.1.4
func (ts IntraDayTimes) Sort(less func(a, b IntraDayTime) bool) IntraDayTimes
func (IntraDayTimes) SortAsc ¶ added in v1.1.4
func (ts IntraDayTimes) SortAsc() IntraDayTimes
type JsonMap ¶ added in v1.0.24
type JsonMap = JsonObject
type JsonObject ¶ added in v1.0.24
type JsonRawMessage ¶ added in v1.0.24
type JsonRawMessage struct {
json.RawMessage
}
func (JsonRawMessage) UnmarshalAsInt ¶ added in v1.0.24
func (message JsonRawMessage) UnmarshalAsInt() (int, error)
func (JsonRawMessage) UnmarshalAsString ¶ added in v1.0.24
func (message JsonRawMessage) UnmarshalAsString() (string, error)
func (JsonRawMessage) UnmarshalTo ¶ added in v1.0.24
func (message JsonRawMessage) UnmarshalTo(dst interface{}) error
type JsonRawMessageMap ¶ added in v1.0.24
type JsonRawMessageMap map[string]JsonRawMessage
func (JsonRawMessageMap) Lookup ¶ added in v1.0.24
func (m JsonRawMessageMap) Lookup(key string) (JsonRawMessage, bool)
type JsonRawStrMessage ¶ added in v1.0.94
type JsonRawStrMessage string
func (JsonRawStrMessage) MarshalJSON ¶ added in v1.0.94
func (msg JsonRawStrMessage) MarshalJSON() ([]byte, error)
func (*JsonRawStrMessage) UnmarshalJSON ¶ added in v1.0.94
func (msg *JsonRawStrMessage) UnmarshalJSON(data []byte) error
type ListIteratorByReflect ¶ added in v1.0.35
type ListIteratorByReflect struct {
// contains filtered or unexported fields
}
func NewSliceIteratorByReflectValue ¶ added in v1.0.35
func NewSliceIteratorByReflectValue(slice reflect.Value) *ListIteratorByReflect
func (*ListIteratorByReflect) Data ¶ added in v1.0.35
func (it *ListIteratorByReflect) Data() any
func (*ListIteratorByReflect) Len ¶ added in v1.0.35
func (it *ListIteratorByReflect) Len() int
func (*ListIteratorByReflect) Next ¶ added in v1.0.35
func (it *ListIteratorByReflect) Next() bool
type MapIteratorByReflect ¶ added in v1.0.35
type MapIteratorByReflect struct {
// contains filtered or unexported fields
}
func NewMapIteratorByReflect ¶ added in v1.0.35
func NewMapIteratorByReflect(m reflect.Value) *MapIteratorByReflect
func (*MapIteratorByReflect) Data ¶ added in v1.0.35
func (it *MapIteratorByReflect) Data() stl.KeyValuePair[any, any]
func (*MapIteratorByReflect) Len ¶ added in v1.0.35
func (it *MapIteratorByReflect) Len() int
func (*MapIteratorByReflect) Next ¶ added in v1.0.35
func (it *MapIteratorByReflect) Next() bool
type NilError ¶ added in v1.0.57
type NilError struct {
// contains filtered or unexported fields
}
func NewNilError ¶ added in v1.0.57
func NewNilErrorFromNames ¶ added in v1.0.57
type NotImplementedError ¶
type NotImplementedError struct {
// contains filtered or unexported fields
}
func NewNotImplementedError ¶
func NewNotImplementedError(hint string) NotImplementedError
func (NotImplementedError) Error ¶
func (e NotImplementedError) Error() string
type PanicError ¶ added in v1.0.69
type PanicError struct {
// contains filtered or unexported fields
}
func NewPanicError ¶ added in v1.0.69
func NewPanicError(exception any, stack string) *PanicError
func (*PanicError) Error ¶ added in v1.0.69
func (err *PanicError) Error() string
type PrivateKeyCipher ¶ added in v1.0.6
type PrivateKeyCipher struct {
PublicKeyCipher
// contains filtered or unexported fields
}
func NewPrivateKeyCipher ¶ added in v1.0.6
func NewPrivateKeyCipher(key *rsa.PrivateKey) *PrivateKeyCipher
func (*PrivateKeyCipher) Decrypt ¶ added in v1.0.6
func (c *PrivateKeyCipher) Decrypt(ciphertext []byte) ([]byte, error)
func (*PrivateKeyCipher) DecryptPro ¶ added in v1.0.6
func (c *PrivateKeyCipher) DecryptPro(ciphertext []byte, decrypter RsaDecrypter, random io.Reader) ([]byte, error)
type PublicKeyCipher ¶ added in v1.0.6
type PublicKeyCipher struct {
// contains filtered or unexported fields
}
func NewPublicKeyCipher ¶ added in v1.0.6
func NewPublicKeyCipher(key *rsa.PublicKey) *PublicKeyCipher
func (*PublicKeyCipher) Encrypt ¶ added in v1.0.6
func (c *PublicKeyCipher) Encrypt(plaintext []byte) ([]byte, error)
func (*PublicKeyCipher) EncryptPro ¶ added in v1.0.6
func (c *PublicKeyCipher) EncryptPro(plaintext []byte, encrypter RsaEncrypter, random io.Reader) ([]byte, error)
func (*PublicKeyCipher) Verify ¶ added in v1.0.6
func (c *PublicKeyCipher) Verify(data, sign []byte) error
func (*PublicKeyCipher) VerifyPro ¶ added in v1.0.6
func (c *PublicKeyCipher) VerifyPro(data, sign []byte, verifier RsaVerifier, hash crypto.Hash) error
type RsaDecrypter ¶ added in v1.0.6
type RsaEncrypter ¶ added in v1.0.6
type RsaVerifier ¶ added in v1.0.6
type SpillBuffer ¶ added in v1.1.0
type SpillBuffer struct {
// contains filtered or unexported fields
}
func NewSpillBuffer ¶ added in v1.1.0
func NewSpillBuffer(memoryWaterMark int, withMutex bool) *SpillBuffer
func (*SpillBuffer) Close ¶ added in v1.1.0
func (sb *SpillBuffer) Close() error
func (*SpillBuffer) WithMemoryWaterMark ¶ added in v1.1.0
func (sb *SpillBuffer) WithMemoryWaterMark(waterMark int) *SpillBuffer
func (*SpillBuffer) WithMutex ¶ added in v1.1.0
func (sb *SpillBuffer) WithMutex() *SpillBuffer
Source Files
¶
Click to show internal directories.
Click to hide internal directories.