Moving server files to ./server

This commit is contained in:
Corteza Monorepo Migrator
2022-11-14 09:26:39 +01:00
parent 204738f7c9
commit 683c7c56e2
5750 changed files with 0 additions and 26430 deletions
+26
View File
@@ -0,0 +1,26 @@
package sql
import (
"encoding/json"
"fmt"
)
func ParseJSON(raw any, dest any) error {
var (
data []byte
)
if b, ok := raw.([]byte); ok {
data = b
} else if s, ok := raw.(string); ok {
data = []byte(s)
} else if raw == nil {
return nil
}
if err := json.Unmarshal(data, dest); err != nil {
return fmt.Errorf("can not scan JSON into %T: %w", dest, err)
}
return nil
}