Skip to content

Commit

Permalink
update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
ThomasTJdev committed May 13, 2021
1 parent ade9d98 commit 499dc88
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,12 @@ otherwise a NULL value (``dbNullVal``) will be used.

``dbValOrNull()`` accepts all types due to `value: auto`.

## Auto NULL-values

There are two generators, which can generate the `NULL` values for you.

* `genArgs` does only set a field to `NULL` if `dbNullVal`/`dbValOrNull()` is passed.
* `genArgsSetNull` sets empty field (`""` / `c.len() == 0`) to `NULL`.

## Executing DB commands

Expand All @@ -50,12 +56,6 @@ The examples below support the various DB commands such as ``exec``,
All the examples uses a table named: ``myTable`` and they use the WHERE argument on: ``name``.


## genArgs / genArgsSetNull

* `genArgs` does only set a field to `NULL` if `dbNullVal` is passed.
* `genArgsSetNull` sets empty field to `NULL`.


## Update string & int

### Version 1
Expand All @@ -76,6 +76,14 @@ All the examples uses a table named: ``myTable`` and they use the WHERE argument
```


### Version 3
```nim
let a = genArgsSetNull("[email protected]", "", "John")
exec(db, sqlUpdate("myTable", ["email", "age"], ["name"], a.query), a.args)
# ==> string, NULL
# ==> UPDATE myTable SET email = ?, age = NULL WHERE name = ?
```


## Update NULL & int

Expand Down

0 comments on commit 499dc88

Please sign in to comment.