forked from LBRYCommunity/lbry-sdk
added support for --order_by=none
This commit is contained in:
parent
15091052be
commit
6a58148a89
2 changed files with 5 additions and 3 deletions
|
@ -4164,7 +4164,7 @@ class Daemon(metaclass=JSONRPCServerType):
|
|||
]
|
||||
[--exclude_internal_transfers]
|
||||
[--wallet_id=<wallet_id>] [--page=<page>] [--page_size=<page_size>]
|
||||
[--resolve] [--no_totals]
|
||||
[--resolve] [--order_by=<order_by>][--no_totals]
|
||||
|
||||
Options:
|
||||
--type=<type> : (str or list) claim type: stream, channel, support,
|
||||
|
@ -4190,7 +4190,7 @@ class Daemon(metaclass=JSONRPCServerType):
|
|||
--page=<page> : (int) page to return during paginating
|
||||
--page_size=<page_size> : (int) number of items on page during pagination
|
||||
--resolve : (bool) resolves each claim to provide additional metadata
|
||||
--order_by=<order_by> : (str) field to order by: 'name', 'height', 'amount'
|
||||
--order_by=<order_by> : (str) field to order by: 'name', 'height', 'amount' and 'none'
|
||||
--no_totals : (bool) do not calculate the total number of pages and items in result set
|
||||
(significant performance boost)
|
||||
|
||||
|
@ -4213,7 +4213,7 @@ class Daemon(metaclass=JSONRPCServerType):
|
|||
if order_by is not None:
|
||||
if order_by == 'name':
|
||||
constraints['order_by'] = 'txo.claim_name'
|
||||
elif order_by in ('height', 'amount'):
|
||||
elif order_by in ('height', 'amount', 'none'):
|
||||
constraints['order_by'] = order_by
|
||||
else:
|
||||
raise ValueError(f"'{order_by}' is not a valid --order_by value.")
|
||||
|
|
|
@ -787,6 +787,8 @@ class Database(SQLiteMixin):
|
|||
constraints['order_by'] = [
|
||||
"tx.height=0 DESC", "tx.height DESC", "tx.position DESC", "txo.position"
|
||||
]
|
||||
elif constraints.get('order_by', None) == 'none':
|
||||
del constraints['order_by']
|
||||
|
||||
rows = await self.select_txos(', '.join(select_columns), read_only=read_only, **constraints)
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue