From 63a2d0f9a99c8fa1cb9d1e763a2eccbbff226c3a Mon Sep 17 00:00:00 2001 From: Simon Brooke <simon@journeyman.cc> Date: Fri, 16 Mar 2018 16:35:35 +0000 Subject: [PATCH] A sort of alpha release --- README.md | 6 ++++++ src/squirrel_parse/core.clj | 5 ++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index ad6450e..80a1356 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,13 @@ structures, for automatic generation of things like This is not production ready code as yet. Nevertheless if you want a sensible entry point, look at the two example functions in `squirrel-parse.core`. +If you want to do something actually a bit useful, try the function +`squirrel-parse.to-hugsql-queries/migrations-to-queries-sql` + +This, given a [Migratus](https://github.com/yogthos/migratus) migrations directory will generate a +[HugSQL](https://www.hugsql.org/) `queries.sql` file which, while it's not +perfect, gets you a very long way. ## Status diff --git a/src/squirrel_parse/core.clj b/src/squirrel_parse/core.clj index d27c830..00e124d 100644 --- a/src/squirrel_parse/core.clj +++ b/src/squirrel_parse/core.clj @@ -1,7 +1,8 @@ (ns squirrel-parse.core (:require [squirrel-parse.parser :refer [parse]] [squirrel-parse.simplify :refer [simplify]] - [squirrel-parse.to-adl :refer [table-definitions-to-entities]])) + [squirrel-parse.to-adl :refer [table-definitions-to-entities]] + [squirrel-parse.to-hugsql-queries :refer [migrations-to-queries-sql]])) ;;; This is get-you-started code. @@ -14,3 +15,5 @@ "Parses the file of SQL commands indicated by `filename`, and returns a more useful map of maps." [filename] (table-definitions-to-entities (parsed-statements-from-file filename))) + +