Commit 57386d6
refactor: fix hash method parameter naming and key handling
Changed hash method parameters to align with Redis/Valkey terminology:
- Renamed 'name' → 'key' (the Redis key for the hash)
- Renamed 'key' → 'field' (the field within the hash)
- Changed type from 'str' to 'KeyT' for consistency with other methods
- Added 'version' parameter support to hlen() and hkeys()
Fixed make_key() application:
- make_key() now only applied to hash key (first parameter)
- Fields are no longer transformed with make_key()
- This fixes the namespacing issue where fields were incorrectly prefixed
- hkeys() now returns plain field names without reverse_key processing
Added comprehensive test for version support across all hash methods.
This improves API clarity and consistency with Redis/Valkey documentation
where 'key' refers to the Redis key (name of the hash structure) and
'field' refers to a field within that hash.
Changed methods:
- hset(key, field, value, ...)
- hdel(key, field, ...)
- hlen(key, ...)
- hkeys(key, ...)
- hexists(key, field, ...)
All hash-related tests pass with the new implementation.
Co-authored-by: 2ykwang <yk2ykwang@gmail.com>1 parent 755dfb2 commit 57386d6
3 files changed
Lines changed: 55 additions & 15 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1131 | 1131 | | |
1132 | 1132 | | |
1133 | 1133 | | |
1134 | | - | |
1135 | 1134 | | |
| 1135 | + | |
1136 | 1136 | | |
1137 | 1137 | | |
1138 | 1138 | | |
1139 | 1139 | | |
1140 | 1140 | | |
1141 | | - | |
| 1141 | + | |
1142 | 1142 | | |
1143 | 1143 | | |
1144 | 1144 | | |
1145 | 1145 | | |
1146 | 1146 | | |
1147 | 1147 | | |
1148 | | - | |
| 1148 | + | |
1149 | 1149 | | |
1150 | 1150 | | |
1151 | 1151 | | |
1152 | | - | |
1153 | 1152 | | |
| 1153 | + | |
1154 | 1154 | | |
1155 | 1155 | | |
1156 | 1156 | | |
1157 | 1157 | | |
1158 | | - | |
| 1158 | + | |
1159 | 1159 | | |
1160 | 1160 | | |
1161 | 1161 | | |
1162 | 1162 | | |
1163 | 1163 | | |
1164 | | - | |
| 1164 | + | |
1165 | 1165 | | |
1166 | 1166 | | |
1167 | 1167 | | |
1168 | | - | |
| 1168 | + | |
| 1169 | + | |
1169 | 1170 | | |
1170 | 1171 | | |
1171 | 1172 | | |
1172 | | - | |
| 1173 | + | |
1173 | 1174 | | |
1174 | 1175 | | |
1175 | 1176 | | |
1176 | | - | |
| 1177 | + | |
| 1178 | + | |
1177 | 1179 | | |
1178 | 1180 | | |
1179 | 1181 | | |
1180 | | - | |
| 1182 | + | |
| 1183 | + | |
1181 | 1184 | | |
1182 | 1185 | | |
1183 | 1186 | | |
1184 | | - | |
| 1187 | + | |
1185 | 1188 | | |
1186 | 1189 | | |
1187 | 1190 | | |
| 1191 | + | |
1188 | 1192 | | |
1189 | | - | |
| 1193 | + | |
1190 | 1194 | | |
1191 | 1195 | | |
1192 | 1196 | | |
1193 | 1197 | | |
1194 | 1198 | | |
1195 | | - | |
1196 | 1199 | | |
| 1200 | + | |
1197 | 1201 | | |
1198 | 1202 | | |
1199 | 1203 | | |
1200 | 1204 | | |
1201 | | - | |
| 1205 | + | |
1202 | 1206 | | |
1203 | 1207 | | |
1204 | 1208 | | |
1205 | 1209 | | |
1206 | | - | |
| 1210 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
871 | 871 | | |
872 | 872 | | |
873 | 873 | | |
| 874 | + | |
| 875 | + | |
| 876 | + | |
| 877 | + | |
| 878 | + | |
| 879 | + | |
| 880 | + | |
| 881 | + | |
| 882 | + | |
| 883 | + | |
| 884 | + | |
| 885 | + | |
| 886 | + | |
| 887 | + | |
| 888 | + | |
| 889 | + | |
| 890 | + | |
| 891 | + | |
| 892 | + | |
| 893 | + | |
| 894 | + | |
| 895 | + | |
| 896 | + | |
| 897 | + | |
| 898 | + | |
| 899 | + | |
| 900 | + | |
| 901 | + | |
| 902 | + | |
| 903 | + | |
| 904 | + | |
| 905 | + | |
| 906 | + | |
| 907 | + | |
| 908 | + | |
874 | 909 | | |
875 | 910 | | |
876 | 911 | | |
| |||
0 commit comments