-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathutil.go
More file actions
47 lines (42 loc) · 1.02 KB
/
Copy pathutil.go
File metadata and controls
47 lines (42 loc) · 1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
package logger
import (
"fmt"
"net/http"
"github.com/aeeem/LogStack/responses"
"github.com/thedevsaddam/renderer"
)
// Rnd ...
var Rnd = renderer.New()
// ResponseRender ...
func ResponseRender(types string, w http.ResponseWriter, statusCode int, v interface{}) {
if types == "error" {
responseData := responses.Standard{
RequestParam: "",
Status: "error",
ErrorMessage: fmt.Sprintf("%v", v),
Data: nil,
Next: "",
Version: responses.Version{Code: "1", Name: "0.1.0"},
}
Rnd.JSON(w, statusCode, responseData)
} else {
responseData := responses.Standard{
RequestParam: "",
Status: "success",
ErrorMessage: "",
Data: v,
Next: "",
Version: responses.Version{Code: "1", Name: "0.1.0"},
}
Rnd.JSON(w, statusCode, responseData)
}
}
// // TimeLocalNow ...
// func TimeLocalNow() *time.Time {
// loc, err := time.LoadLocation("Asia/Jakarta")
// if err != nil {
// Info(err)
// }
// now := time.Now().In(loc)
// return &now
// }