Add general queue

This commit is contained in:
Achim Rohn
2025-11-16 19:09:01 +01:00
parent ed7ee7e95c
commit bcc5c7493d
60 changed files with 5657 additions and 8506 deletions
+39
View File
@@ -0,0 +1,39 @@
package ersteller
import "encoding/json"
type JSONB map[string]interface{}
func StructToMap(data interface{}) (JSONB, error) {
var result JSONB
// Marshal struct to JSON bytes
jsonBytes, err := json.Marshal(data)
if err != nil {
return nil, err
}
// Unmarshal JSON bytes to map
err = json.Unmarshal(jsonBytes, &result)
if err != nil {
return nil, err
}
return result, nil
}
func MapToStruct(data JSONB, result interface{}) error {
// Marshal map to JSON bytes
jsonBytes, err := json.Marshal(data)
if err != nil {
return err
}
// Unmarshal JSON bytes to struct
err = json.Unmarshal(jsonBytes, result)
if err != nil {
return err
}
return nil
}