Skip to content

Commit

Permalink
Merge pull request #24 from jebberjeb/readme
Browse files Browse the repository at this point in the history
updated readme for datetime validator
  • Loading branch information
theleoborges committed Oct 22, 2014
2 parents a5d66d8 + e8a86b5 commit e59db39
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,21 @@ Note the double vector:
- the inner one wraps a single validation where the first element is the validating function and the rest are options for that validation.
- the outer vector simply denotes a list of validations to be applied

Below is an example of date-time validation. A [clj-time formatter](https://github.com/clj-time/clj-time#clj-timeformat)
may optionally be supplied.

```clojure
(require '[bouncer [core :as b] [validators :as v]] '[clj-time.format :as f])

(def person {:name "Jeb" :last-login "2014-10-21 18:00:00"})

(b/validate person
:name v/required
:last-login v/datetime (:mysql f/formatters))

;; [nil {:name "Jeb" :last-login "2014-10-21 18:00:00"}]
```

### Validating nested maps

Nested maps can easily be validated as well, using the built-in validators:
Expand Down Expand Up @@ -486,6 +501,8 @@ I didn't spend a whole lot of time on *bouncer* so it only ships with the valida
- `bouncer.validators/every` (for ad-hoc validation of collections. All items must match the provided predicate)
- `bouncer.validators/datetime` (uses [clj-time formatters](https://github.com/clj-time/clj-time#clj-timeformat))
## Contributing
Pull requests of bug fixes and new validators are most welcome.
Expand Down

0 comments on commit e59db39

Please sign in to comment.