Browse Source

rest_result

0x4a52466c696e74 3 months ago
parent
commit
9894f2428c
1 changed files with 18 additions and 0 deletions
  1. 18 0
      rest_result/result_ok.go

+ 18 - 0
rest_result/result_ok.go

@@ -0,0 +1,18 @@
+package rest_result
+
+import "git.ali33.ru/fcg-xvii/go-tools/json"
+
+func NewResultOK(data any) *ResultOK {
+	if data == nil {
+		data = json.Map{}
+	}
+	return &ResultOK{
+		OK:   true,
+		Data: data,
+	}
+}
+
+type ResultOK struct {
+	OK   bool `rest:"default"`
+	Data any  `rest:"default"`
+}