()
| 16 | |
| 17 | |
| 18 | def main() -> None: |
| 19 | todo_id = id() |
| 20 | db.transact( |
| 21 | db.tx.todos[todo_id].update( |
| 22 | { |
| 23 | "text": "Hello from Python!", |
| 24 | "done": False, |
| 25 | "createdAt": int(time.time() * 1000), |
| 26 | } |
| 27 | ) |
| 28 | ) |
| 29 | |
| 30 | result = db.query({"todos": {}}) |
| 31 | print(f"Found {len(result['todos'])} todo(s):") |
| 32 | for todo in result["todos"]: |
| 33 | status = "x" if todo["done"] else " " |
| 34 | print(f" [{status}] {todo['text']}") |
| 35 | |
| 36 | |
| 37 | if __name__ == "__main__": |