Documentation
¶
Overview ¶
Package utilitee provides utility functions that can be used across the project
Index ¶
- func MustParseRSAKey(b64 string) *rsa.PrivateKey
- func RightNow() time.Time
- func SafeIntToInt32(i *int) int32
- func SliceOfPointersToPointerSlice[T any](slice []*T) *[]T
- func SliceOfPointersToSlice[T any](slice []*T) []T
- func SliceOfValuesToSliceOfPointers[T any](slice []T) []*T
- type ErrPrivateKeyIssue
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MustParseRSAKey ¶ added in v0.1.78
func MustParseRSAKey(b64 string) *rsa.PrivateKey
MustParseRSAKey parses a base64-encoded RSA private key in PEM format. It panics if the key cannot be parsed.
func RightNow ¶
RightNow is a simple utility function to ensure consistency of returning a "now" timestamp being localized to UTC.
func SafeIntToInt32 ¶ added in v0.1.0
SafeIntToInt32 safely converts an *int to int32, returning 0 if the pointer is nil or if the value is out of int32 bounds.
func SliceOfPointersToPointerSlice ¶ added in v0.1.69
func SliceOfPointersToPointerSlice[T any](slice []*T) *[]T
SafeIntToInt64 safely converts an *int to int64, returning 0 if the pointer is nil or if the value is out of int64 bounds.
func SliceOfPointersToSlice ¶ added in v0.1.69
func SliceOfPointersToSlice[T any](slice []*T) []T
PointerSliceToSliceOfPointers converts a pointer to a slice of values to a slice of pointers. If the input pointer is nil, it returns nil.
func SliceOfValuesToSliceOfPointers ¶ added in v0.1.69
func SliceOfValuesToSliceOfPointers[T any](slice []T) []*T
SliceOfValuesToSliceOfPointers converts a slice of values to a slice of pointers. If the input slice is nil, it returns nil.
Types ¶
type ErrPrivateKeyIssue ¶ added in v0.1.78
type ErrPrivateKeyIssue struct{}
func (ErrPrivateKeyIssue) Error ¶ added in v0.1.78
func (e ErrPrivateKeyIssue) Error() string