summaryrefslogtreecommitdiff
path: root/api/utils.go
diff options
context:
space:
mode:
authorsinanmohd <sinan@sinanmohd.com>2024-07-04 13:13:23 +0530
committersinanmohd <sinan@sinanmohd.com>2024-07-05 17:02:06 +0530
commite2f67996a608346ea3f3525ef2febf6ca5d2b78c (patch)
tree932f766b65ed5a6ff3d57c772292a2b75210d9aa /api/utils.go
parente309091d17720b69c53172a41c0ea45ad7b66911 (diff)
refactor: drop http api, move to sqlc/postgresql
Diffstat (limited to 'api/utils.go')
-rw-r--r--api/utils.go31
1 files changed, 0 insertions, 31 deletions
diff --git a/api/utils.go b/api/utils.go
deleted file mode 100644
index 0fc7d35..0000000
--- a/api/utils.go
+++ /dev/null
@@ -1,31 +0,0 @@
-package api
-
-import (
- "encoding/json"
- "fmt"
- "io"
- "log"
- "net/http"
-)
-
-func unmarshal(r io.Reader, v any) error {
- body, err := io.ReadAll(r)
- if err != nil {
- return err
- }
-
- err = json.Unmarshal(body, v)
- if err != nil {
- return err
- }
-
- return nil
-}
-
-func handleError(err error, rw http.ResponseWriter, status int) {
- log.Println(err)
-
- rw.WriteHeader(status)
- json := fmt.Sprintf(`{"Error": "%v"}`, http.StatusText(status))
- rw.Write([]byte(json))
-}