Skip to content

Commit

Permalink
updat docs, fix many-to-many metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
tamizhvendan committed May 15, 2020
1 parent 277e270 commit 2adabf1
Show file tree
Hide file tree
Showing 12 changed files with 327 additions and 83 deletions.
27 changes: 13 additions & 14 deletions doc/coercion.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
### Type Mappings
# Coercion

While retrieving the data from the database, HoneyEQL coerce the return value to the corresponding JVM type as mentioned in the below table.

| Type | Postgres | MySQL |
| ---------------- | ------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------- |
| java.lang.Long | `integer`, `int`, `int2` `int4`, `smallint`, `smallserial`, `serial`, `serial2`, `serial4`, `bigint`,`int8`,`bigserial`,`serial8` | `SMALLINT`, `MEDIUMINT`, `INT`, `TINYINT UNSIGNED`, `SMALLINT UNSIGNED`, `MEDIUMINT UNSIGNED`, `YEAR`, `INT UNSIGNED`, `BIGINT` |
| java.math.BigDecimal | `real`, `float4`, `float8`, `double precision`,`numeric`,`decimal` | `REAL`, `FLOAT`, `DOUBLE`, `DECIMAL`, `NUMERIC` |
| java.lang.String | `bit`, `bit varying`, `char`, `character varying`, `varchar`, `citext`, `bpchar`, `macaddr8`, `text`, `money` | `CHAR`, `VARCHAR`, `TINYTEXT`, `TEXT`, `MEDIUMTEXT`, `LONGTEXT`, `ENUM`, `SET`, `BINARY`, `VARBINARY`, `TINYBLOB,` `BLOB`, `LONGBLOB`, `BIT` |
| java.lang.Boolean | `boolean` | `TINYINT(1)`, `BIT(1)`|
| java.util.UUID | `uuid` | -- |
| java.time.LocalDate | `date`| `DATE`|
| java.time.LocalTime | `time`, `time without time zone`| `TIME`|
| java.time.OffsetTime | `timetz`, `time with time zone` | --|
| java.time.LocalDateTime | `timestamp`, `timestamp without time zone` | `DATETIME`, `TIMESTAMP` |
| java.time.OffsetDateTime| `timestamptz`, `timestamp with time zone` | -- |

| Type | Postgres | MySQL |
| ------------------------ | --------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- |
| java.lang.Long | `integer`, `int`, `int2` `int4`, `smallint`, `smallserial`, `serial`, `serial2`, `serial4`, `bigint`,`int8`,`bigserial`,`serial8` | `SMALLINT`, `MEDIUMINT`, `INT`, `TINYINT UNSIGNED`, `SMALLINT UNSIGNED`, `MEDIUMINT UNSIGNED`, `YEAR`, `INT UNSIGNED`, `BIGINT` |
| java.math.BigDecimal | `real`, `float4`, `float8`, `double precision`,`numeric`,`decimal` | `REAL`, `FLOAT`, `DOUBLE`, `DECIMAL`, `NUMERIC` |
| java.lang.String | `bit`, `bit varying`, `char`, `character varying`, `varchar`, `citext`, `bpchar`, `macaddr8`, `text`, `money` | `CHAR`, `VARCHAR`, `TINYTEXT`, `TEXT`, `MEDIUMTEXT`, `LONGTEXT`, `ENUM`, `SET`, `BINARY`, `VARBINARY`, `TINYBLOB,` `BLOB`, `LONGBLOB`, `BIT` |
| java.lang.Boolean | `boolean` | `TINYINT(1)`, `BIT(1)` |
| java.util.UUID | `uuid` | -- |
| java.time.LocalDate | `date` | `DATE` |
| java.time.LocalTime | `time`, `time without time zone` | `TIME` |
| java.time.OffsetTime | `timetz`, `time with time zone` | -- |
| java.time.LocalDateTime | `timestamp`, `timestamp without time zone` | `DATETIME`, `TIMESTAMP` |
| java.time.OffsetDateTime | `timestamptz`, `timestamp with time zone` | -- |
56 changes: 55 additions & 1 deletion doc/configuration.md
Original file line number Diff line number Diff line change
@@ -1 +1,55 @@
## TODO
# Configuration

During the initialization of the database adapter, HoneyEQL enables you to configure and override certain default behaviors of it.

```clojure
(ns ..
(:require [honeyeql.db :as db]))

(def db-spec ...)

; using default behaviors
(def db-adapter (db/initialize db-spec))

; overriding default behaviors
(def heql-config {...})
(def db-adapter (db/initialize db-spec heql-config))
```

The `heql-config` is a map with the following keys.

## EQL Mode

`:eql/mode` - configures the EQL syntax

### Possible Values

* `:eql.mode/lenient` - Use EQL Lenient Syntax (default)
* `:eql.mode/strict` - Use EQL Standard Syntax

## Attribute Return As

`:attr/return-as` - configures the naming convention of the attributes in the return values.

### Possible Values

* `:naming-convention/qualified-kebab-case` (default)
```clojure
; sample return value
{:actor/first-name "PENELOPE"
:actor/last-name "GUINESS"}
```

* `:naming-convention/unqualified-kebab-case`
```clojure
; sample return value
{first-name "PENELOPE"
last-name "GUINESS"}
```

* `:naming-convention/unqualified-camel-case`
```clojure
; sample return value
{firstName "PENELOPE"
lastName "GUINESS"}
```
Loading

0 comments on commit 2adabf1

Please sign in to comment.