Added documentation on usage of Enum.
This commit is contained in:
parent
f2412bc170
commit
2ec1995350
14
README.md
14
README.md
|
@ -93,6 +93,20 @@ The following type-dataType combinations are supported:
|
||||||
Example:
|
Example:
|
||||||
`{ startTime : { type: Date, dataType: 'timestamp' }}`
|
`{ startTime : { type: Date, dataType: 'timestamp' }}`
|
||||||
|
|
||||||
|
* <h4> Enum </h4>
|
||||||
|
Create an Enum using Enum factory:
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
var MOOD = schema.EnumFactory('glad', 'sad', 'mad');
|
||||||
|
MOOD.SAD; // 'sad'
|
||||||
|
MOOD(2); // 'sad'
|
||||||
|
MOOD('SAD'); // 'sad'
|
||||||
|
MOOD('sad'); // 'sad'
|
||||||
|
```
|
||||||
|
|
||||||
|
* `{ mood: { type: MOOD } }`
|
||||||
|
* `{ choice: { type: schema.EnumFactory('yes', 'no', 'maybe'), null: false }`
|
||||||
|
|
||||||
## MIT License
|
## MIT License
|
||||||
|
|
||||||
```text
|
```text
|
||||||
|
|
Loading…
Reference in New Issue