Skip to content

optional wrapping for queries from one file #56

@cyberhuman

Description

@cyberhuman

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.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions