コード例 #1
0
ファイル: test_nested.py プロジェクト: angru/corm
 class Item(Entity):
     id: int = Field(pk=True)
     items: t.List['Item'] = Nested(  # noqa: F821
         entity_type='Item',
         many=True,
         back_relation=True,
         default=list,
     )
     parent: 'Item' = Relationship(entity_type='Item')  # noqa: F821
コード例 #2
0
class SomeEntity(Entity):
    id: int = Field(pk=True)
    name: str
コード例 #3
0
 class User(Entity):
     id: int = Field(pk=True)
     guid: str = Field(pk=True)
     name: str
コード例 #4
0
 class User(Entity):
     id: int = Field(pk=True)
コード例 #5
0
 class Data(Entity):
     in_place = 1
     in_place_callable = list
     in_field = Field(default=2)
     in_field_callable = Field(default=list)
コード例 #6
0
 class User(Entity):
     id: int
     name: str = Field(default='Bob')
     description: str = 'some text'
コード例 #7
0
 class Data(Entity):
     attr1 = Field(origin='_attr1', destination='attr1_')
     attr2 = Field(origin='_attr2')
     attr3 = Field(destination='attr3_')
コード例 #8
0
 class User(Entity):
     id: int = Field(pk=True, mode=AccessMode.GET_LOAD_DUMP)
     guid: str = Field(pk=True)
     name: str = Field(mode=AccessMode.GET_LOAD_DUMP)
     description: str
コード例 #9
0
class SomeEntity(Entity):
    id: int = Field(pk=True)
    name: str
    holder: 'EntityHolder' = Relationship(entity_type='EntityHolder')
コード例 #10
0
class Foo(Entity):
    inplace = 1
    in_field = Field(default=2)
    in_field_callable = Field(default=list)
コード例 #11
0
ファイル: test_nested.py プロジェクト: angru/corm
 class User(Entity):
     id: int
     name: str = Field(default='Bob')
     address: Address = Nested(entity_type=Address)
コード例 #12
0
ファイル: entity_fields.py プロジェクト: angru/corm
class User(Entity):
    id: int = Field(origin='user_id')
    name: str
    description: str = Field(default='user')