Skip to content

Instantly share code, notes, and snippets.

@throughnothing
Created May 25, 2019 06:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save throughnothing/6386368f22a74c62d7c521c85a23494c to your computer and use it in GitHub Desktop.
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.
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