Skip to content

Commit

Permalink
Added Unique() examples in documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
Codemation committed Aug 16, 2022
1 parent cf167ae commit 50a8a22
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@ $ pip install pydbantic[postgres]

```python
from typing import List, Optional, Union
from pydbantic import DataBaseModel, PrimaryKey
from pydbantic import DataBaseModel, PrimaryKey, Unique

class Department(DataBaseModel):
department_id: str = PrimaryKey()
name: str
name: str = Unique()
company: str
is_sensitive: bool = False
positions: List[Optional['Positions']] = [] # One to Many
Expand Down
3 changes: 2 additions & 1 deletion docs/model-usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
```python
from typing import List, Optional
from pydantic import BaseModel, Field
from pydbantic import DataBaseModel, PrimaryKey
from pydbantic import DataBaseModel, PrimaryKey, Unique

class Coordinates(BaseModel):

Expand All @@ -30,6 +30,7 @@ class EmployeeInfo(DataBaseModel):

class Employee(DataBaseModel):
id: str = PrimaryKey()
bio_id: str = Unique()
employee_info: EmployeeInfo
position: Positions
salary: float
Expand Down

0 comments on commit 50a8a22

Please sign in to comment.