Created
May 25, 2019 06:23
-
-
Save throughnothing/6386368f22a74c62d7c521c85a23494c to your computer and use it in GitHub Desktop.
Is this a "clever" way to handle DB models? It keeps it POJO, and reduces redundancy for non-id'ed (and non-createdAt'ed) objects.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type WithId r = ( id :: Int | r ) | |
type WithCreatedAt r = ( createdAt :: String | r ) | |
type DB r = { | (WithId (WithCreatedAt r)) } | |
type DBUser = DB UserRows | |
type User = { | UserRows } | |
type UserRows = | |
( googleId :: String | |
, name :: String | |
, email :: String | |
, picture :: String | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment