diff --git a/redis.go b/redis.go index de68d70..eac3f87 100644 --- a/redis.go +++ b/redis.go @@ -66,20 +66,20 @@ func NewRedisClient(uri string) (*redis.Client, error) { return redis.NewClient(option), nil } -type SetOption = string -type GetOption = [2]any +type RedisonSetOption = string +type RedisonGetOption = [2]any const ( // JSONSET command Options - SetOptionNX SetOption = "NX" - SetOptionXX SetOption = "XX" + RedisonSetOptionNX RedisonSetOption = "NX" + RedisonSetOptionXX RedisonSetOption = "XX" ) var ( - GetOptionSPACE = GetOption{"SPACE", " "} - GetOptionINDENT = GetOption{"INDENT", "\t"} - GetOptionNEWLINE = GetOption{"NEWLINE", "\n"} - GetOptionNOESCAPE = GetOption{"NOESCAPE", ""} + RedisonGetOptionSPACE = RedisonGetOption{"SPACE", " "} + RedisonGetOptionINDENT = RedisonGetOption{"INDENT", "\t"} + RedisonGetOptionNEWLINE = RedisonGetOption{"NEWLINE", "\n"} + RedisonGetOptionNOESCAPE = RedisonGetOption{"NOESCAPE", ""} ) // gocommon으로 옮길 거 @@ -146,7 +146,7 @@ func (rh *RedisonHandler) JSONMSet(key string, kv map[string]any) error { return rh.JSONMSetRel(key, "", kv) } -func (rh *RedisonHandler) jsonSetMergeJSONSet(cmd, key, path string, obj any, opts ...SetOption) (bool, error) { +func (rh *RedisonHandler) jsonSetMergeJSONSet(cmd, key, path string, obj any, opts ...RedisonSetOption) (bool, error) { b, err := json.Marshal(obj) if err != nil { return false, err @@ -170,15 +170,15 @@ func (rh *RedisonHandler) jsonSetMergeJSONSet(cmd, key, path string, obj any, op return res.(string) == "OK", nil } -func (rh *RedisonHandler) JSONSet(key, path string, obj any, opts ...SetOption) (bool, error) { +func (rh *RedisonHandler) JSONSet(key, path string, obj any, opts ...RedisonSetOption) (bool, error) { return rh.jsonSetMergeJSONSet("JSON.SET", key, path, obj, opts...) } -func (rh *RedisonHandler) JSONMerge(key, path string, obj any, opts ...SetOption) (bool, error) { +func (rh *RedisonHandler) JSONMerge(key, path string, obj any, opts ...RedisonSetOption) (bool, error) { return rh.jsonSetMergeJSONSet("JSON.MERGE", key, path, obj, opts...) } -func (rh *RedisonHandler) JSONGet(key, path string, opts ...GetOption) (res any, err error) { +func (rh *RedisonHandler) JSONGet(key, path string, opts ...RedisonGetOption) (res any, err error) { args := appendArgs[string]([]any{ "JSON.GET", key,