Part of lp.services.database.decoratedresultset View In Hierarchy
Because DistroSeriesBinaryPackage
doesn't actually exist in the
database, the DistroSeries
.searchPackages method uses the
DistroSeriesPackageCache
object to search for packages within a
DistroSeries
.
Nonetheless, the users of the searchPackages method (such as the
DistroSeriesView
) expect a result set of DSBPs. Rather than executing
the query prematurely and doing a list comprehension on the complete
result set (which could be very large) to convert all the results (even
though batching may mean only a window of 10 results is required), this
adapted result set converts the results only when they are needed.
This behaviour is required for other classes as well (Distribution, DistroArchSeries), hence a generalised solution.
Method | __init__ | Wrap result_set in a decorator. |
Method | decorate_single | Decorate a result or return None if the result is itself None |
Method | copy | See IResultSet . |
Method | config | See IResultSet . |
Method | __iter__ | See IResultSet . |
Method | __getitem__ | See IResultSet . |
Method | iterhook_one_elem | Undocumented |
Method | any | See IResultSet . |
Method | first | See IResultSet . |
Method | last | See IResultSet . |
Method | one | See IResultSet . |
Method | order_by | See IResultSet . |
Method | get_plain_result_set | Return the plain Storm result set. |
Method | find | See IResultSet . |
Method | _extract_plain_and_result | Extract the plain and normal results from a sub-result. |
result_set
in a decorator.
The decorator will act as a result set where a result row self[x]
is really result_decorator(result_set[x])
.
Parameters | result_set | The original result set to be decorated. |
result_decorator | A transformation function that individual results will be passed through. Mutually exclusive with bulk_decorator. | |
pre_iter_hook | The method to be called (with the 'result_set') immediately before iteration starts. The return value of the hook is ignored. | |
bulk_decorator | A transformation function that chunks of results will be passed through. Mutually exclusive with result_decorator. | |
slice_info | If True pass information about the slice parameters to the result_decorator and pre_iter_hook. any() and similar methods will cause None to be supplied. | |
return_both | If True return both the plain and decorated values as a tuple. |
This gets slightly complicated when there are nested DecoratedResultSets, as we have to propogate the plain result all the way up.
IResultSet
.Returns | The decorated version of the returned result set. |
IResultSet
.Returns | The decorated result set.after updating the config. |
IResultSet
.
Yield a decorated version of the returned value.
IResultSet
.Returns | The decorated version of the returned value. |
IResultSet
.Returns | The decorated version of the returned value. |