Skip to content

Commit

Permalink
Make SlotInternalIndex values persistable.
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathanknowles committed Jul 6, 2020
1 parent 859f529 commit 8022262
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions lib/core/src/Cardano/Wallet/DB/Sqlite/Types.hs
Expand Up @@ -35,6 +35,7 @@ import Cardano.Wallet.Primitive.Types
, PoolId
, PoolOwner (..)
, SlotId (..)
, SlotInternalIndex (..)
, SlotNo (..)
, StakeKeyCertificate (..)
, StakePoolMetadataHash (..)
Expand Down Expand Up @@ -327,6 +328,22 @@ instance PathPiece SlotId where
toPathPiece = error "toPathPiece stub needed for persistent"
fromPathPiece = error "fromPathPiece stub needed for persistent"

----------------------------------------------------------------------------
-- SlotInternalIndex

instance PersistFieldSql SlotInternalIndex where
sqlType _ = sqlType (Proxy @Word64)

instance PersistField SlotInternalIndex where
toPersistValue = toPersistValue . unSlotInternalIndex
fromPersistValue = fmap SlotInternalIndex . fromPersistValue

instance ToJSON SlotInternalIndex where
toJSON = toJSON . unSlotInternalIndex

instance FromJSON SlotInternalIndex where
parseJSON = fmap SlotInternalIndex . parseJSON

----------------------------------------------------------------------------
-- TxStatus

Expand Down

0 comments on commit 8022262

Please sign in to comment.