Add Go rewrite with Postgres 17 and Dokploy Docker Compose

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
orohi
2026-07-27 08:21:21 +03:00
co-authored by Cursor
parent bac78dd3fc
commit 99a27f00be
67 changed files with 17864 additions and 0 deletions
+27
View File
@@ -0,0 +1,27 @@
package web
import (
"encoding/json"
"net/http"
)
// writeJSON writes v as a JSON response with the given status code.
func writeJSON(w http.ResponseWriter, status int, v any) {
w.Header().Set("Content-Type", "application/json; charset=utf-8")
w.WriteHeader(status)
_ = json.NewEncoder(w).Encode(v)
}
// writeJSONError writes {"ok":false,"error":msg} with the given status code.
func writeJSONError(w http.ResponseWriter, status int, msg string) {
writeJSON(w, status, map[string]any{"ok": false, "error": msg})
}
// writeJSONOK writes {"ok":true, ...extra} with HTTP 200.
func writeJSONOK(w http.ResponseWriter, extra map[string]any) {
if extra == nil {
extra = map[string]any{}
}
extra["ok"] = true
writeJSON(w, http.StatusOK, extra)
}