hashx.go 431 B

1234567891011121314151617
  1. package redisx
  2. import "context"
  3. // 哈希封装
  4. func HSet(ctx context.Context, key string, values map[string]interface{}) error {
  5. return getClient().HSet(ctx, key, values).Err()
  6. }
  7. func HGet(ctx context.Context, key, field string) (string, error) {
  8. return getClient().HGet(ctx, key, field).Result()
  9. }
  10. func HGetAll(ctx context.Context, key string) (map[string]string, error) {
  11. return getClient().HGetAll(ctx, key).Result()
  12. }