v0.0.357
All checks were successful
Build Docker and Deploy / Run goext test-suite (push) Successful in 1m4s

This commit is contained in:
Mike Schwörer 2024-01-05 10:59:06 +01:00
parent 9264a2e99b
commit 413178e2d3
Signed by: Mikescher
GPG Key ID: D3C7172E0A70F8CF
2 changed files with 57 additions and 2 deletions

View File

@ -270,6 +270,61 @@ func (ee *ExErr) GetMeta(key string) (any, bool) {
return nil, false
}
// GetMetaString functions the same as GetMeta, but returns false if the type does not match
func (ee *ExErr) GetMetaString(key string) (string, bool) {
if v1, ok := ee.GetMeta(key); ok {
if v2, ok := v1.(string); ok {
return v2, true
}
}
return "", false
}
func (ee *ExErr) GetMetaBool(key string) (bool, bool) {
if v1, ok := ee.GetMeta(key); ok {
if v2, ok := v1.(bool); ok {
return v2, true
}
}
return false, false
}
func (ee *ExErr) GetMetaInt(key string) (int, bool) {
if v1, ok := ee.GetMeta(key); ok {
if v2, ok := v1.(int); ok {
return v2, true
}
}
return 0, false
}
func (ee *ExErr) GetMetaFloat32(key string) (float32, bool) {
if v1, ok := ee.GetMeta(key); ok {
if v2, ok := v1.(float32); ok {
return v2, true
}
}
return 0, false
}
func (ee *ExErr) GetMetaFloat64(key string) (float64, bool) {
if v1, ok := ee.GetMeta(key); ok {
if v2, ok := v1.(float64); ok {
return v2, true
}
}
return 0, false
}
func (ee *ExErr) GetMetaTime(key string) (time.Time, bool) {
if v1, ok := ee.GetMeta(key); ok {
if v2, ok := v1.(time.Time); ok {
return v2, true
}
}
return time.Time{}, false
}
// contains test if the supplied error is contained in this error (anywhere in the chain)
func (ee *ExErr) contains(original *ExErr) (*ExErr, bool) {
if original == nil {

View File

@ -1,5 +1,5 @@
package goext
const GoextVersion = "0.0.356"
const GoextVersion = "0.0.357"
const GoextVersionTimestamp = "2024-01-05T10:43:39+0100"
const GoextVersionTimestamp = "2024-01-05T10:59:06+0100"