diff options
author | sinanmohd <sinan@sinanmohd.com> | 2024-07-04 13:13:23 +0530 |
---|---|---|
committer | sinanmohd <sinan@sinanmohd.com> | 2024-07-05 17:02:06 +0530 |
commit | e2f67996a608346ea3f3525ef2febf6ca5d2b78c (patch) | |
tree | 932f766b65ed5a6ff3d57c772292a2b75210d9aa /api/utils.go | |
parent | e309091d17720b69c53172a41c0ea45ad7b66911 (diff) |
refactor: drop http api, move to sqlc/postgresql
Diffstat (limited to 'api/utils.go')
-rw-r--r-- | api/utils.go | 31 |
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)) -} |