summaryrefslogtreecommitdiff
path: root/README.md
diff options
context:
space:
mode:
authorYuval Adam <_@yuv.al>2024-05-07 16:42:41 +0200
committerYuval Adam <_@yuv.al>2024-05-07 20:56:12 +0200
commit3ebf529934ad4932a0dd7deeffa31c4deee2e72d (patch)
tree654661de06a717d0f0921a2aa6de7c168ca2ff74 /README.md
parent966cb2525d060f0b80e2d32277cf212c23625f47 (diff)
Initial autokey functionality
Diffstat (limited to 'README.md')
-rw-r--r--README.md4
1 files changed, 4 insertions, 0 deletions
diff --git a/README.md b/README.md
index 7eebf3e..9cfc571 100644
--- a/README.md
+++ b/README.md
@@ -6,14 +6,18 @@ Define a dataclass:
```python
from dataclasses import dataclass
+from typing import ClassVar
@dataclass
class User:
name: str
age: int
active: bool
+ key: ClassVar[str] = "name"
```
+Note the `key` field which is used to denote that `name` should be used as the primary key field.
+
Instantiate a new object:
```python