코드 정리 및 websocket도 http와 비슷하게 api handler로 통일

This commit is contained in:
2023-09-08 11:35:57 +09:00
parent eb54fa2e3a
commit 6cbf32c386
10 changed files with 216 additions and 130 deletions

View File

@ -195,6 +195,17 @@ func (rh *RedisonHandler) JSONGetString(key, path string) ([]string, error) {
return respToArray[string](rh.JSONResp(key, path))
}
func (rh *RedisonHandler) JSONGetDocuments(key, path string) ([]map[string]any, error) {
resp, err := rh.JSONGet(key, path)
if err != nil && err != redis.Nil {
return nil, err
}
var objs []map[string]any
err = json.Unmarshal([]byte(resp.(string)), &objs)
return objs, err
}
func (rh *RedisonHandler) JSONGetInt64(key, path string) ([]int64, error) {
return respToArray[int64](rh.JSONResp(key, path))
}