From 7dfd130b1c0bd909b604e2273792f840be4decee Mon Sep 17 00:00:00 2001 From: Yuval Adam <_@yuv.al> Date: Tue, 7 May 2024 20:55:09 +0200 Subject: Finalize key field functionality --- README.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'README.md') diff --git a/README.md b/README.md index 9cfc571..25737d2 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,8 @@ A simple ORM-like utility for operating on local YAML files via Python dataclasses. +## Usage + Define a dataclass: ```python @@ -16,7 +18,7 @@ class User: key: ClassVar[str] = "name" ``` -Note the `key` field which is used to denote that `name` should be used as the primary key field. +Note the special `key` field which is used to denote that `name` should be used as the primary key field. Instantiate a new object: @@ -30,7 +32,7 @@ Save it to file: from ymlstash import YmlStash stash = YmlStash(User, "path/to/db") -stash.save("yuval", user) +stash.save(user) ``` Load from file: -- cgit v1.3.1