@@ -175,6 +175,11 @@ type CoreCmdable interface {
175175 HPExpireTime (ctx context.Context , key string , fields ... string ) * IntSliceCmd
176176 HTTL (ctx context.Context , key string , fields ... string ) * IntSliceCmd
177177 HPTTL (ctx context.Context , key string , fields ... string ) * IntSliceCmd
178+ HGetDel (ctx context.Context , key string , fields ... string ) * StringSliceCmd
179+ HGetEX (ctx context.Context , key string , fields ... string ) * StringSliceCmd
180+ HGetEXWithArgs (ctx context.Context , key string , options * HGetEXOptions , fields ... string ) * StringSliceCmd
181+ HSetEX (ctx context.Context , key string , fieldsAndValues ... string ) * IntCmd
182+ HSetEXWithArgs (ctx context.Context , key string , options * HSetEXOptions , fieldsAndValues ... string ) * IntCmd
178183
179184 BLPop (ctx context.Context , timeout time.Duration , keys ... string ) * StringSliceCmd
180185 BLMPop (ctx context.Context , timeout time.Duration , direction string , count int64 , keys ... string ) * KeyValuesCmd
@@ -1554,6 +1559,92 @@ func (c *Compat) HPTTL(ctx context.Context, key string, fields ...string) *IntSl
15541559 return newIntSliceCmd (resp )
15551560}
15561561
1562+ func (c * Compat ) HGetDel (ctx context.Context , key string , fields ... string ) * StringSliceCmd {
1563+ cmd := c .client .B ().Hgetdel ().Key (key ).Fields ().Numfields (int64 (len (fields ))).Field (fields ... ).Build ()
1564+ resp := c .client .Do (ctx , cmd )
1565+ return newStringSliceCmd (resp )
1566+ }
1567+
1568+ func (c * Compat ) HGetEX (ctx context.Context , key string , fields ... string ) * StringSliceCmd {
1569+ cmd := c .client .B ().Hgetex ().Key (key ).Fields ().Numfields (int64 (len (fields ))).Field (fields ... ).Build ()
1570+ resp := c .client .Do (ctx , cmd )
1571+ return newStringSliceCmd (resp )
1572+ }
1573+
1574+ func (c * Compat ) HGetEXWithArgs (ctx context.Context , key string , options * HGetEXOptions , fields ... string ) * StringSliceCmd {
1575+ if options == nil {
1576+ return c .HGetEX (ctx , key , fields ... )
1577+ }
1578+
1579+ var cmd valkey.Completed
1580+ if options .ExpirationType == HGetEXExpirationEX {
1581+ cmd = c .client .B ().Hgetex ().Key (key ).Ex (options .ExpirationVal ).Fields ().Numfields (int64 (len (fields ))).Field (fields ... ).Build ()
1582+ } else if options .ExpirationType == HGetEXExpirationPX {
1583+ cmd = c .client .B ().Hgetex ().Key (key ).Px (options .ExpirationVal ).Fields ().Numfields (int64 (len (fields ))).Field (fields ... ).Build ()
1584+ } else if options .ExpirationType == HGetEXExpirationEXAT {
1585+ cmd = c .client .B ().Hgetex ().Key (key ).Exat (options .ExpirationVal ).Fields ().Numfields (int64 (len (fields ))).Field (fields ... ).Build ()
1586+ } else if options .ExpirationType == HGetEXExpirationPXAT {
1587+ cmd = c .client .B ().Hgetex ().Key (key ).Pxat (options .ExpirationVal ).Fields ().Numfields (int64 (len (fields ))).Field (fields ... ).Build ()
1588+ } else if options .ExpirationType == HGetEXExpirationPERSIST {
1589+ cmd = c .client .B ().Hgetex ().Key (key ).Persist ().Fields ().Numfields (int64 (len (fields ))).Field (fields ... ).Build ()
1590+ }
1591+ resp := c .client .Do (ctx , cmd )
1592+ return newStringSliceCmd (resp )
1593+ }
1594+
1595+ func (c * Compat ) HSetEX (ctx context.Context , key string , fieldsAndValues ... string ) * IntCmd {
1596+ partial := c .client .B ().Hsetex ().Key (key ).Fields ().Numfields (int64 (len (fieldsAndValues ) / 2 )).FieldValue ()
1597+
1598+ for i := 0 ; i < len (fieldsAndValues ); i += 2 {
1599+ partial = partial .FieldValue (fieldsAndValues [i ], fieldsAndValues [i + 1 ])
1600+ }
1601+ cmd := partial .Build ()
1602+
1603+ resp := c .client .Do (ctx , cmd )
1604+ return newIntCmd (resp )
1605+ }
1606+
1607+ func (c * Compat ) HSetEXWithArgs (ctx context.Context , key string , options * HSetEXOptions , fieldsAndValues ... string ) * IntCmd {
1608+ if options == nil {
1609+ return c .HSetEX (ctx , key , fieldsAndValues ... )
1610+ }
1611+
1612+ var partial cmds.HsetexFieldValue
1613+ if options .Condition == HSetEXFNX {
1614+ if options .ExpirationType == HSetEXExpirationEX {
1615+ partial = c .client .B ().Hsetex ().Key (key ).Fnx ().Ex (options .ExpirationVal ).Fields ().Numfields (int64 (len (fieldsAndValues ) / 2 )).FieldValue ()
1616+ } else if options .ExpirationType == HSetEXExpirationPX {
1617+ partial = c .client .B ().Hsetex ().Key (key ).Fnx ().Px (options .ExpirationVal ).Fields ().Numfields (int64 (len (fieldsAndValues ) / 2 )).FieldValue ()
1618+ } else if options .ExpirationType == HSetEXExpirationEXAT {
1619+ partial = c .client .B ().Hsetex ().Key (key ).Fnx ().Exat (options .ExpirationVal ).Fields ().Numfields (int64 (len (fieldsAndValues ) / 2 )).FieldValue ()
1620+ } else if options .ExpirationType == HSetEXExpirationPXAT {
1621+ partial = c .client .B ().Hsetex ().Key (key ).Fnx ().Pxat (options .ExpirationVal ).Fields ().Numfields (int64 (len (fieldsAndValues ) / 2 )).FieldValue ()
1622+ } else if options .ExpirationType == HSetEXExpirationKEEPTTL {
1623+ partial = c .client .B ().Hsetex ().Key (key ).Fnx ().Keepttl ().Fields ().Numfields (int64 (len (fieldsAndValues ) / 2 )).FieldValue ()
1624+ }
1625+ } else if options .Condition == HSetEXFXX {
1626+ if options .ExpirationType == HSetEXExpirationEX {
1627+ partial = c .client .B ().Hsetex ().Key (key ).Fxx ().Ex (options .ExpirationVal ).Fields ().Numfields (int64 (len (fieldsAndValues ) / 2 )).FieldValue ()
1628+ } else if options .ExpirationType == HSetEXExpirationPX {
1629+ partial = c .client .B ().Hsetex ().Key (key ).Fxx ().Px (options .ExpirationVal ).Fields ().Numfields (int64 (len (fieldsAndValues ) / 2 )).FieldValue ()
1630+ } else if options .ExpirationType == HSetEXExpirationEXAT {
1631+ partial = c .client .B ().Hsetex ().Key (key ).Fxx ().Exat (options .ExpirationVal ).Fields ().Numfields (int64 (len (fieldsAndValues ) / 2 )).FieldValue ()
1632+ } else if options .ExpirationType == HSetEXExpirationPXAT {
1633+ partial = c .client .B ().Hsetex ().Key (key ).Fxx ().Pxat (options .ExpirationVal ).Fields ().Numfields (int64 (len (fieldsAndValues ) / 2 )).FieldValue ()
1634+ } else if options .ExpirationType == HSetEXExpirationKEEPTTL {
1635+ partial = c .client .B ().Hsetex ().Key (key ).Fxx ().Keepttl ().Fields ().Numfields (int64 (len (fieldsAndValues ) / 2 )).FieldValue ()
1636+ }
1637+ }
1638+
1639+ for i := 0 ; i < len (fieldsAndValues ); i += 2 {
1640+ partial = partial .FieldValue (fieldsAndValues [i ], fieldsAndValues [i + 1 ])
1641+ }
1642+
1643+ cmd := partial .Build ()
1644+ resp := c .client .Do (ctx , cmd )
1645+ return newIntCmd (resp )
1646+ }
1647+
15571648func (c * Compat ) BLPop (ctx context.Context , timeout time.Duration , keys ... string ) * StringSliceCmd {
15581649 cmd := c .client .B ().Blpop ().Key (keys ... ).Timeout (float64 (formatSec (timeout ))).Build ()
15591650 resp := c .client .Do (ctx , cmd )
0 commit comments