Skip to content

Commit eddd828

Browse files
committed
Extend docs for Box.query() #52
1 parent d652e0f commit eddd828

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

objectbox/box.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -166,13 +166,20 @@ def remove_all(self) -> int:
166166
return int(count.value)
167167

168168
def query(self, condition: Optional[QueryCondition] = None) -> QueryBuilder:
169-
""" Creates a QueryBuilder for the Entity that is managed by the Box.
169+
""" Initiates Query creation for the Entity associated by this Box.
170+
Technically, it creates a QueryBuilder object, and you have to call build() on it to get the Query object.
170171
171172
:param condition:
172-
If given, applies the given high-level condition to the new QueryBuilder object.
173-
Useful for a user-friendly API design; for example:
173+
Applies the given condition(s) to the new QueryBuilder object.
174+
For example, assuming you defined an @Entity called "MyEntity" with a string property "name":
174175
175-
``box.query(MyEntity.name.equals("Johnny")).build()``
176+
``query = box.query(MyEntity.name.equals("Johnny")).build()``
177+
178+
It's also possible to pass multiple conditions:
179+
180+
``query = box.query(MyEntity.name.equals("Johnny") & MyEntity.age.greater(21)).build()``
181+
182+
Note: ``&`` is the logical AND operator, and ``|`` is the logical OR operator.
176183
"""
177184
qb = QueryBuilder(self._store, self)
178185
if condition is not None:

0 commit comments

Comments
 (0)