Skip to content
This repository was archived by the owner on Jul 19, 2025. It is now read-only.

Commit c209ca4

Browse files
committed
Add uuid1 provider
1 parent 4a9d447 commit c209ca4

1 file changed

Lines changed: 12 additions & 2 deletions

File tree

app/Main.hs

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import qualified Data.Text as T
1212
import qualified Data.Text.Read as T
1313
import qualified Data.UUID as UUID
1414
import qualified Data.UUID.V4 as UUID4
15+
import qualified Data.UUID.V1 as UUID1
1516
import Lib
1617
import System.Environment (getArgs)
1718

@@ -26,9 +27,18 @@ parseColumnDefinition x =
2627
parts = T.splitOn "=" text
2728

2829

30+
uuid1 :: IO UUID.UUID
31+
uuid1 = do
32+
uuid <- UUID1.nextUUID
33+
case uuid of
34+
(Just u) -> pure u
35+
Nothing -> uuid1
36+
37+
2938
lookupProvider :: Text -> IO Value
30-
lookupProvider "uuid4" = String . UUID.toText <$> UUID4.nextRandom
31-
lookupProvider _ = pure $ String "foobar"
39+
lookupProvider "uuid4" = String . UUID.toText <$> UUID4.nextRandom
40+
lookupProvider "uuid1" = String . UUID.toText <$> uuid1
41+
lookupProvider _ = pure $ String "foobar"
3242

3343

3444
main :: IO ()

0 commit comments

Comments
 (0)