mdmoss / doobie-codegen Goto Github PK
View Code? Open in Web Editor NEWGenerate Doobie database code from sql statements.
License: MIT License
Generate Doobie database code from sql statements.
License: MIT License
I'll deal with this
Generate wrappers for multi get by fields to take in a singular field, as opposed to list
ALTER TABLE article owner TO someuser;
Getting error
Invalid input 'o', expected [ \n\t], 'A' or 'D' (line 1, column 37):
COMMENT ON COLUMN artilce.id IS 'It is an auto increamented id';
Invalid input 'E', expected 'i' (line 1, column 5):
This is possible with upserts, apparently.
Will deal with this.
Currently, they just use id
.
This would make copying things much neater.
This reflects the standard behaviour of most databases (and probably the standard).
A comment on the first line seems to be needed to trigger this
Example file:
-- A comment
-- doobie-codegen: off
DROP TABLE tbl;
-- doobie-codegen: on
Unexpected end of input, expected AlterSequence, With, Update, Commit, CreateTable, Begin, CreateExtension, DropView, Delete, DropTable, CreateView, CreateSchema, Insert, CreateIndex or AlterTable (line 1, column 1):
^
[error] (run-main-4) ParseError(Position(0,1,1), Position(0,1,1), <21 traces>)
ParseError(Position(0,1,1), Position(0,1,1), <21 traces>)
at org.parboiled2.Parser.done$1(Parser.scala:185)
at org.parboiled2.Parser.phase4_collectRuleTraces$1(Parser.scala:196)
at org.parboiled2.Parser.__run(Parser.scala:209)
at mdmoss.doobiegen.Runner$$anonfun$run$1.apply(Runner.scala:76)
at mdmoss.doobiegen.Runner$$anonfun$run$1.apply(Runner.scala:75)
at scala.collection.immutable.List.foreach(List.scala:381)
at mdmoss.doobiegen.Runner$.run(Runner.scala:75)
At some stage we merged all the multiget queries into one. This was done to improve compile times.
Later, we discovered the reason why this makes compilation faster: The scala compiler needs to build up an implicit Meta for getting data out of JDBC and into a Row case class. We now generate Meta instances for Row so the compiler doesn't need to do extra work to generate one.
Now that we are doing this, compiling multiple multiget queries should be fast again. Having separate queries will make it easier to interpret DB logs and performance statistics, which is quite valuable for debugging and profiling.
Currently, the semantics of multiget (by primary key) provide that the output will be ordered the same as the input, and duplicate keys in the input will correspond to duplicate rows in the output. These semantics can be used for zipping the output with a list containing the input, although often it is unnecessary for this condition to hold.
The semantics of multigetBy are similar, although for each input there might be multiple rows of output, and the relative ordering of rows with the same key is undefined. I am not convinced these semantics are particularly useful, so I am inclined not to preserve them in a future version.
In either case, it may be helpful optimisation to provide a "fast" multiget which provides different or lesser guarantees. For example, output order could be undefined, or sorted by key (which would not pressure the database significantly more than leaving output order undefined). Additionally, a version of multigetBy could sort by foreign key then primary key so that there is a well-defined total ordering.
A way to include a column in create
s, but exclude them from update
s.
For example, allUnbounded and all can share the same query underneath.
Would be nice if it had;
"ALTER TABLE " ~ TableRef ~ "ALTER COLUMN " ~ ValidIdentifier ~ "SET " ~ ColumnProperty ~ ";"
Instead of
ALTER TABLE x ADD a TEXT; ALTER TABLE x ADD b TEXT; ALTER TABLE x ADD c TEXT;
it should be possible to do this
ALTER TABLE x ADD a TEXT, ADD b TEXT, ADD c TEXT;
without gen complaining.
This could be done with Default \/ T
or Option[T]
.
I will deal with this.
Including CURRENT_TIMESTAMP.
I will probably deal with this.
It would be useful to have queries generated for look-ups by unique fields.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.