petrol icon indicating copy to clipboard operation
petrol copied to clipboard

feat: add nullable fields and handling

Open tjdevries opened this issue 2 years ago • 0 comments

Wondering if you are thinking there are any better options than this kind of idea?

This let's users do:

    let table, fields =
      StaticSchema.declare_table
        schema
        ~name:"optional"
        ~constraints:[]
        (let open Schema in
         [ field "id" ~ty:Type.int ~constraints:[ primary_key (); not_null () ]
         ; field "username" ~ty:(Type.null_ty Type.text)
         ])

and encode the possibility of null in the field type.

tjdevries avatar Sep 06 '23 17:09 tjdevries