-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Description
Is your feature request related to a problem? Please describe.
The queries.sql file is becoming very large and contains SQL queries for many different domains (subscribers, campaigns, lists, etc.). This makes it difficult to navigate, maintain, and debug queries. The current approach of loading the entire file into memory at once can also be inefficient.
Describe the solution you'd like
I propose to split the queries.sql file into smaller, domain-specific files within a new queries/ directory. For example:
queries/subscribers.sqlqueries/campaigns.sqlqueries/lists.sql- ... and so on.
This change would involve the following steps:
- File Splitting: Create the new SQL files and move the corresponding queries from
queries.sqlto these new files. - Code Changes:
- In
cmd/init.go,cmd/install.goandcmd/main.go, modify the query loading logic to iterate over all files in thequeries/directory. - For each file, use the existing
readQueriesfunction to parse the queries. - Merge the resulting query maps into a single map that the application can use.
- In
- Build Process:
- Update the
Makefileto include the newqueries/directory in the build dependencies. - Update the
initFSfunction incmd/init.goto embed the newqueries/directory into the application binary.
- Update the
This refactoring will improve code organization, making it easier for developers to work with the SQL queries and improving the overall maintainability of the project. This could also be a good "good first issue" for new contributors.