Skip to content

Commit 7944d87

Browse files
authored
Apply suggestions from code review
Format the links in the documentation. Add missing documentation.
1 parent 89534e2 commit 7944d87

File tree

1 file changed

+37
-8
lines changed

1 file changed

+37
-8
lines changed

hash_commands.go

Lines changed: 37 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,9 @@ type HExpireArgs struct {
225225
// HExpire - Sets the expiration time for specified fields in a hash in seconds.
226226
// The command constructs an argument list starting with "HEXPIRE", followed by the key, duration, any conditional flags, and the specified fields.
227227
// Available since Redis 7.4 CE.
228-
// For more information - https://redis.io/commands/hexpire/
228+
// For more information refer to [HEXPIRE Documentation].
229+
//
230+
// [HEXPIRE Documentation]: https://redis.io/commands/hexpire/
229231
func (c cmdable) HExpire(ctx context.Context, key string, expiration time.Duration, fields ...string) *IntSliceCmd {
230232
args := []interface{}{"HEXPIRE", key, formatSec(ctx, expiration), "FIELDS", len(fields)}
231233

@@ -241,7 +243,9 @@ func (c cmdable) HExpire(ctx context.Context, key string, expiration time.Durati
241243
// It requires a key, an expiration duration, a struct with boolean flags for conditional expiration settings (NX, XX, GT, LT), and a list of fields.
242244
// The command constructs an argument list starting with "HEXPIRE", followed by the key, duration, any conditional flags, and the specified fields.
243245
// Available since Redis 7.4 CE.
244-
// For more information - https://redis.io/commands/hexpire/
246+
// For more information refer to [HEXPIRE Documentation].
247+
//
248+
// [HEXPIRE Documentation]: https://redis.io/commands/hexpire/
245249
func (c cmdable) HExpireWithArgs(ctx context.Context, key string, expiration time.Duration, expirationArgs HExpireArgs, fields ...string) *IntSliceCmd {
246250
args := []interface{}{"HEXPIRE", key, formatSec(ctx, expiration)}
247251

@@ -271,7 +275,9 @@ func (c cmdable) HExpireWithArgs(ctx context.Context, key string, expiration tim
271275
// Similar to HExpire, it accepts a key, an expiration duration in milliseconds, a struct with expiration condition flags, and a list of fields.
272276
// The command modifies the standard time.Duration to milliseconds for the Redis command.
273277
// Available since Redis 7.4 CE.
274-
// For more information - https://redis.io/commands/hpexpire/
278+
// For more information refer to [HPEXPIRE Documentation].
279+
//
280+
// [HPEXPIRE Documentation]: https://redis.io/commands/hpexpire/
275281
func (c cmdable) HPExpire(ctx context.Context, key string, expiration time.Duration, fields ...string) *IntSliceCmd {
276282
args := []interface{}{"HPEXPIRE", key, formatMs(ctx, expiration), "FIELDS", len(fields)}
277283

@@ -283,7 +289,13 @@ func (c cmdable) HPExpire(ctx context.Context, key string, expiration time.Durat
283289
return cmd
284290
}
285291

292+
// HPExpireWithArgs - Sets the expiration time for specified fields in a hash in milliseconds.
293+
// It requires a key, an expiration duration, a struct with boolean flags for conditional expiration settings (NX, XX, GT, LT), and a list of fields.
294+
// The command constructs an argument list starting with "HPEXPIRE", followed by the key, duration, any conditional flags, and the specified fields.
286295
// Available since Redis 7.4 CE.
296+
// For more information refer to [HPEXPIRE Documentation].
297+
//
298+
// [HPEXPIRE Documentation]: https://redis.io/commands/hpexpire/
287299
func (c cmdable) HPExpireWithArgs(ctx context.Context, key string, expiration time.Duration, expirationArgs HExpireArgs, fields ...string) *IntSliceCmd {
288300
args := []interface{}{"HPEXPIRE", key, formatMs(ctx, expiration)}
289301

@@ -313,7 +325,9 @@ func (c cmdable) HPExpireWithArgs(ctx context.Context, key string, expiration ti
313325
// Takes a key, a UNIX timestamp, a struct of conditional flags, and a list of fields.
314326
// The command sets absolute expiration times based on the UNIX timestamp provided.
315327
// Available since Redis 7.4 CE.
316-
// For more information - https://redis.io/commands/hexpireat/
328+
// For more information refer to [HExpireAt Documentation].
329+
//
330+
// [HExpireAt Documentation]: https://redis.io/commands/hexpireat/
317331
func (c cmdable) HExpireAt(ctx context.Context, key string, tm time.Time, fields ...string) *IntSliceCmd {
318332

319333
args := []interface{}{"HEXPIREAT", key, tm.Unix(), "FIELDS", len(fields)}
@@ -353,8 +367,10 @@ func (c cmdable) HExpireAtWithArgs(ctx context.Context, key string, tm time.Time
353367

354368
// HPExpireAt - Sets the expiration time for specified fields in a hash to a UNIX timestamp in milliseconds.
355369
// Similar to HExpireAt but for timestamps in milliseconds. It accepts the same parameters and adjusts the UNIX time to milliseconds.
356-
// Available since Redis 7.4 CE.
357-
// For more information - https://redis.io/commands/hpexpireat/
370+
// Available since Redis 7.4 CE.
371+
// For more information refer to [HExpireAt Documentation].
372+
//
373+
// [HExpireAt Documentation]: https://redis.io/commands/hexpireat/
358374
func (c cmdable) HPExpireAt(ctx context.Context, key string, tm time.Time, fields ...string) *IntSliceCmd {
359375
args := []interface{}{"HPEXPIREAT", key, tm.UnixNano() / int64(time.Millisecond), "FIELDS", len(fields)}
360376

@@ -395,7 +411,9 @@ func (c cmdable) HPExpireAtWithArgs(ctx context.Context, key string, tm time.Tim
395411
// Accepts a key and the fields themselves.
396412
// This command ensures that each field specified will have its expiration removed if present.
397413
// Available since Redis 7.4 CE.
398-
// For more information - https://redis.io/commands/hpersist/
414+
// For more information refer to [HPersist Documentation].
415+
//
416+
// [HPersist Documentation]: https://redis.io/commands/hpersist/
399417
func (c cmdable) HPersist(ctx context.Context, key string, fields ...string) *IntSliceCmd {
400418
args := []interface{}{"HPERSIST", key, "FIELDS", len(fields)}
401419

@@ -411,6 +429,9 @@ func (c cmdable) HPersist(ctx context.Context, key string, fields ...string) *In
411429
// Requires a key and the fields themselves to fetch their expiration timestamps.
412430
// This command returns the expiration times for each field or error/status codes for each field as specified.
413431
// Available since Redis 7.4 CE.
432+
// For more information refer to [HExpireTime Documentation].
433+
//
434+
// [HExpireTime Documentation]: https://redis.io/commands/hexpiretime/
414435
// For more information - https://redis.io/commands/hexpiretime/
415436
func (c cmdable) HExpireTime(ctx context.Context, key string, fields ...string) *IntSliceCmd {
416437
args := []interface{}{"HEXPIRETIME", key, "FIELDS", len(fields)}
@@ -427,6 +448,9 @@ func (c cmdable) HExpireTime(ctx context.Context, key string, fields ...string)
427448
// Similar to HExpireTime, adjusted for timestamps in milliseconds. It requires the same parameters.
428449
// Provides the expiration timestamp for each field in milliseconds.
429450
// Available since Redis 7.4 CE.
451+
// For more information refer to [HExpireTime Documentation].
452+
//
453+
// [HExpireTime Documentation]: https://redis.io/commands/hexpiretime/
430454
// For more information - https://redis.io/commands/hexpiretime/
431455
func (c cmdable) HPExpireTime(ctx context.Context, key string, fields ...string) *IntSliceCmd {
432456
args := []interface{}{"HPEXPIRETIME", key, "FIELDS", len(fields)}
@@ -443,7 +467,9 @@ func (c cmdable) HPExpireTime(ctx context.Context, key string, fields ...string)
443467
// Requires a key and the fields themselves. It returns the TTL for each specified field.
444468
// This command fetches the TTL in seconds for each field or returns error/status codes as appropriate.
445469
// Available since Redis 7.4 CE.
446-
// For more information - https://redis.io/commands/httl/
470+
// For more information refer to [HTTL Documentation].
471+
//
472+
// [HTTL Documentation]: https://redis.io/commands/httl/
447473
func (c cmdable) HTTL(ctx context.Context, key string, fields ...string) *IntSliceCmd {
448474
args := []interface{}{"HTTL", key, "FIELDS", len(fields)}
449475

@@ -459,6 +485,9 @@ func (c cmdable) HTTL(ctx context.Context, key string, fields ...string) *IntSli
459485
// Similar to HTTL, but returns the TTL in milliseconds. It requires a key and the specified fields.
460486
// This command provides the TTL in milliseconds for each field or returns error/status codes as needed.
461487
// Available since Redis 7.4 CE.
488+
// For more information refer to [HPTTL Documentation].
489+
//
490+
// [HPTTL Documentation]: https://redis.io/commands/hpttl/
462491
// For more information - https://redis.io/commands/hpttl/
463492
func (c cmdable) HPTTL(ctx context.Context, key string, fields ...string) *IntSliceCmd {
464493
args := []interface{}{"HPTTL", key, "FIELDS", len(fields)}

0 commit comments

Comments
 (0)