arorm-0.3.3
توضیحات
A python orm with identity pattern mainly for arango
| ویژگی | مقدار |
|---|---|
| سیستم عامل | - |
| نام فایل | arorm-0.3.3 |
| نام | arorm |
| نسخه کتابخانه | 0.3.3 |
| نگهدارنده | [] |
| ایمیل نگهدارنده | [] |
| نویسنده | Patrick Pircher |
| ایمیل نویسنده | - |
| آدرس صفحه اصلی | https://github.com/patricklx/ar-orm |
| آدرس اینترنتی | https://pypi.org/project/arorm/ |
| مجوز | MIT |
# arorm
arango orm with identity pattern
## examples
```python
import typing
from arorm import ListProperty, Field, ObjectProperty, PasswordField, Model, ReferenceId, Reference, ReferenceIdList, ReferenceList, Store, RemoteReferenceList
class UserAttributes(ObjectProperty):
class Settings(ObjectProperty):
notifications = Field(default=False)
html5Notifications = Field(default=False)
last_update: float = Field(default=0)
last_login: float = Field(default=0)
settings = Settings()
class User(Model):
__collection__ = 'users'
name = Field()
password = PasswordField(hidden=True)
email = Field()
attributes = UserAttributes()
achievements: typing.List[str] = ListProperty(str)
books: typing.List['Book'] = RemoteReferenceList('author_id', 'Book')
class Book(Model):
__collection__ = 'books'
author_id = ReferenceId()
author = Reference(author_id, User)
co_authors_ids = ReferenceIdList()
co_authors: typing.List[User] = ReferenceList(co_authors_ids, User)
db = dict(host='127.0.01', user='root', password='root', port=8529, driver='arango')
store = Store(db)
store.setup_db()
user = store.create(User) # will create a user on commit
book = store.create(Book) # will create a book on commit
book.author = user
book.co_authors.append(user)
store.query(User).filter(User.name == 'admin').delete() # queued to be executed on commit
store.run_after_commit(lambda: print('did commit'))
store.commit()
user.to_json() # -> will now have _id, _rev
book.to_json() # -> will now have author_id set to same id as user
```
نیازمندی
| مقدار | نام |
|---|---|
| - | event-emitter |
| - | inflection |
| - | arango |
| - | arango-orm |
نحوه نصب
نصب پکیج whl arorm-0.3.3:
pip install arorm-0.3.3.whl
نصب پکیج tar.gz arorm-0.3.3:
pip install arorm-0.3.3.tar.gz