adding method to get account by name
This commit is contained in:
parent
99d6450473
commit
39c05a0b2e
2 changed files with 12 additions and 0 deletions
|
|
@ -1155,4 +1155,13 @@ namespace graphene { namespace app {
|
|||
return result;
|
||||
}
|
||||
|
||||
optional<account_object> database_api::get_account_by_name( string name )const
|
||||
{
|
||||
const auto& idx = _db.get_index_type<account_index>().indices().get<by_name>();
|
||||
auto itr = idx.find(name);
|
||||
if (itr != idx.end())
|
||||
return *itr;
|
||||
return optional<account_object>();
|
||||
}
|
||||
|
||||
} } // graphene::app
|
||||
|
|
|
|||
|
|
@ -110,6 +110,8 @@ namespace graphene { namespace app {
|
|||
* This function has semantics identical to @ref get_objects
|
||||
*/
|
||||
vector<optional<account_object>> lookup_account_names(const vector<string>& account_names)const;
|
||||
optional<account_object> get_account_by_name( string name )const;
|
||||
|
||||
/**
|
||||
* @brief Get a list of assets by symbol
|
||||
* @param asset_symbols Symbols or stringified IDs of the assets to retrieve
|
||||
|
|
@ -515,6 +517,7 @@ FC_API(graphene::app::database_api,
|
|||
(get_accounts)
|
||||
(get_assets)
|
||||
(lookup_account_names)
|
||||
(get_account_by_name)
|
||||
(get_account_count)
|
||||
(lookup_accounts)
|
||||
(get_full_accounts)
|
||||
|
|
|
|||
Loading…
Reference in a new issue