Merge pull request #436 from strongloop/enum

fix(docs): update enum type
This commit is contained in:
Diana Lau 2020-09-17 13:39:09 -04:00 committed by GitHub
commit c681b2dbe7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 17 deletions

View File

@ -434,23 +434,7 @@ startTime: Date;
### Enum
Enums are special. Create an Enum using Enum factory:
```ts
const MOOD = dataSource.EnumFactory('glad', 'sad', 'mad');
MOOD.SAD; // 'sad'
MOOD(2); // 'sad'
MOOD('SAD'); // 'sad'
MOOD('sad'); // 'sad'
export class User extends Entity {
//..
@property({
type: MOOD,
})
mood: MOOD;
}
```
See the [Model ENUM property](https://loopback.io/doc/en/lb4/Model.html#enum-property) for details.
### Default Clause/Constant