ygrek / sqlgg

SQL Guided (code) Generator
https://ygrek.org/p/sqlgg/
GNU General Public License v2.0
62 stars 20 forks source link

optional wrapping for queries from one file #56

Open cyberhuman opened 6 years ago

cyberhuman commented 6 years ago

When invoking sqlgg file1.sql file2.sql ... fileN.sql, it would be nice to have every file's queries wrapped in a module:

module Sqlgg (T : Sqlgg_traits.M) = struct

module File1 = struct
  let get_by_id db ~id =
    let get_row stmt =
      (T.get_column_Int stmt 0), (T.get_column_Text stmt 1), (T.get_column_Text stmt 2), (T.get_column_Text stmt 3)
    in
    ...
end
...
module FileN = struct
  let get_by_id db ~id =
    let get_row stmt =
      (T.get_column_Int stmt 0), (T.get_column_Text stmt 1), (T.get_column_Text stmt 2), (T.get_column_Text stmt 3)
    in
    ...
end

end

Also, if all DDL (CREATE TABLE etc) were not wrapped and put on the very top of the module, it would be possible to use a single table declaration from many files, provided they are fed to sqlgg togethere.