null...
This commit is contained in:
parent
cb39a76dd9
commit
37f4990252
1
.gitignore
vendored
1
.gitignore
vendored
@ -15,3 +15,4 @@
|
||||
# Dependency directories (remove the comment below to include it)
|
||||
# vendor/
|
||||
|
||||
sqldb-ws
|
||||
|
@ -104,12 +104,21 @@ func (t *TableController) GetAllTable() {
|
||||
data, err := db.Table(table).GetAssociativeArray(columns, restriction, sortkeys, dir)
|
||||
if err != nil {
|
||||
log.Error().Msg(err.Error())
|
||||
t.Data["json"] = map[string]string{"error": err.Error()}
|
||||
t.Ctx.Output.SetStatus(http.StatusBadRequest)
|
||||
} else {
|
||||
t.Data["json"] = data
|
||||
}
|
||||
t.ServeJSON()
|
||||
str, err := json.Marshal(data)
|
||||
if err != nil {
|
||||
log.Error().Msg(err.Error())
|
||||
t.Ctx.Output.SetStatus(http.StatusBadRequest)
|
||||
}
|
||||
strToByte := []byte(strings.ReplaceAll(string(str), "\"\\u003cnil\\u003e\"", "null"))
|
||||
t.Ctx.Output.Header("Content-Type", "application/json")
|
||||
t.Ctx.Output.Body(strToByte)
|
||||
t.Ctx.Output.SetStatus(http.StatusOK)
|
||||
db.Close()
|
||||
t.Ctx.Output.Body(strToByte)
|
||||
}
|
||||
|
||||
// @Title GetAllTableColumn
|
||||
|
Loading…
Reference in New Issue
Block a user