From 6138a5ce200d0c1ebc2730fd565bc7bcfdcdc230 Mon Sep 17 00:00:00 2001 From: Clemens Fries Date: Thu, 19 May 2016 00:28:53 +0200 Subject: Fix alternative name handling for columns, plus a lot of documentation. --- src/main/java/overview.adoc | 36 +++++++++++++++++++++++++----------- 1 file changed, 25 insertions(+), 11 deletions(-) (limited to 'src/main/java/overview.adoc') diff --git a/src/main/java/overview.adoc b/src/main/java/overview.adoc index 90a82f6..90642bb 100644 --- a/src/main/java/overview.adoc +++ b/src/main/java/overview.adoc @@ -1,18 +1,32 @@ -= Eduard XVII — The loyal MUC servant +== Ormpaloompa — Sort-of-ORM for EduardXVII -== Continuous Integration +Because the friendly MUC chat bot EduardXVII needs to deal in several places +with simple-structured SQLite tables, I created this tiny object-relational +mapper. It stinks in several places, but it also gets its job done. Coverage is +over 85% and should go further north. -We currently use the CI of Gitlab.com, but it might be warranted to use a -dedicated runner which could execute the requests much faster. This is work -for Future Homer. +It mainly consists of the class `Table` which can be used as follows. -Currently everything is configured in the file `.gitlab-ci.yml`: +As simple class could look like this: -[source,yaml] +[source,java] ---- -include::../../../.gitlab-ci.yml[] +class Bird { + @Column(identity = true) + public Integer id; + + @Column + public String name; +} ---- -NOTE: Replacing `ec.SunEC` is done here because there were problems in the - Docker container with OpenJDK. Apparently making a HTTPS connection - to the Gradle repositories would not work. \ No newline at end of file +Then create a `Table` object and use it to interact with the database. + +[source,java] +---- +Table t = new Table<>(Bird.class, someDatabaseConnection); +Bird newBird = new Bird(); +newBird.name = "A new bird"; +Object id = table.insert(newBird); +Bird storedBird = t.getById(id).get(); +---- -- cgit