Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

optional wrapping for queries from one file #56

Open
cyberhuman opened this issue Nov 1, 2018 · 0 comments
Open

optional wrapping for queries from one file #56

cyberhuman opened this issue Nov 1, 2018 · 0 comments
Assignees

Comments

@cyberhuman
Copy link
Contributor

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.

@ygrek ygrek self-assigned this Nov 9, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants