a database layer insipred by caqti and ecto

Compare changes

Choose any two refs to compare.

+1 -1
dune-project
··· 1 1 (lang dune 3.20) 2 2 3 3 (name repodb) 4 - (version 0.3.1) 4 + (version 0.3.2) 5 5 (source 6 6 ; (tangled @gdiazlo.tngl.sh/hcs) 7 7 (uri git+https://tangled.org/gdiazlo.tngl.sh/repodb))
+34
lib/expr.ml
··· 2 2 | Lit : 'a * 'a Types.t -> 'a t 3 3 | Column : ('record, 'a) Field.t -> 'a t 4 4 | Null : 'a Types.t -> 'a option t 5 + | Some : 'a t -> 'a option t 5 6 | Binop : string * 'a t * 'b t * 'c Types.t -> 'c t 6 7 | Unop : string * 'a t * 'b Types.t -> 'b t 7 8 | Func : string * wrapped list * 'a Types.t -> 'a t ··· 22 23 let string s = Lit (s, Types.string) 23 24 let bool b = Lit (b, Types.bool) 24 25 let null ty = Null ty 26 + let some expr = Some expr 27 + 28 + let int_opt v = 29 + match v with 30 + | None -> Null Types.int 31 + | Stdlib.Option.Some n -> Some (Lit (n, Types.int)) 32 + 33 + let int32_opt v = 34 + match v with 35 + | None -> Null Types.int32 36 + | Stdlib.Option.Some n -> Some (Lit (n, Types.int32)) 37 + 38 + let int64_opt v = 39 + match v with 40 + | None -> Null Types.int64 41 + | Stdlib.Option.Some n -> Some (Lit (n, Types.int64)) 42 + 43 + let float_opt v = 44 + match v with 45 + | None -> Null Types.float 46 + | Stdlib.Option.Some f -> Some (Lit (f, Types.float)) 47 + 48 + let string_opt v = 49 + match v with 50 + | None -> Null Types.string 51 + | Stdlib.Option.Some s -> Some (Lit (s, Types.string)) 52 + 53 + let bool_opt v = 54 + match v with 55 + | None -> Null Types.bool 56 + | Stdlib.Option.Some b -> Some (Lit (b, Types.bool)) 57 + 25 58 let column field = Column field 26 59 let raw s = Raw s 27 60 let param n ty = Param (n, ty) ··· 164 197 | Lit (v, ty) -> lit_to_sql_buf buf v ty 165 198 | Column field -> Buffer.add_string buf (Field.qualified_name field) 166 199 | Null _ -> Buffer.add_string buf "NULL" 200 + | Some e -> to_sql_buf buf e 167 201 | Binop (op, a, b, _) -> 168 202 Buffer.add_char buf '('; 169 203 to_sql_buf buf a;
+1 -1
repodb-postgresql.opam
··· 1 1 # This file is generated by dune, edit dune-project instead 2 2 opam-version: "2.0" 3 - version: "0.3.1" 3 + version: "0.3.2" 4 4 synopsis: "PostgreSQL driver for repodb" 5 5 description: 6 6 "PostgreSQL driver implementation for repodb using the postgresql-ocaml library."
+1 -1
repodb-sqlite.opam
··· 1 1 # This file is generated by dune, edit dune-project instead 2 2 opam-version: "2.0" 3 - version: "0.3.1" 3 + version: "0.3.2" 4 4 synopsis: "SQLite driver for repodb" 5 5 description: 6 6 "SQLite driver implementation for repodb using the sqlite3-ocaml library."
+1 -1
repodb.opam
··· 1 1 # This file is generated by dune, edit dune-project instead 2 2 opam-version: "2.0" 3 - version: "0.3.1" 3 + version: "0.3.2" 4 4 synopsis: "Ecto-like database toolkit for OCaml" 5 5 description: 6 6 "repodb is a database toolkit inspired by Elixir's Ecto. It provides type-safe query building, schema definitions, changesets for data validation, and database migrations."