Whats necessary to close this ticket:
Details
This issue is to discuss filters and find/search as functions and parameters on functions such as listVariables and getVariables
We can retrieve the objects or the labels with (We currently have filters on some get and list functions)
get[Plural] returns a vector of object with optional filter
list returns a vector of labels with optional filter
find[all] can be aliased to list if we wanted
findfirst can be used for a more efficient list()[1] (but list is not that expensive)
The main difference in findfirst and list will be the return type and error behaviour. list always returns a vector while with findfirst you would want the first element in the vector and nothing (julia way) if empty.
Then there is also search as an option, but I see that more for a bigger scope such as searching across all graphs in the DB.
What I think is still missing is an efficient and clear findfirst then get
We can just use get[Plural][1] to retrieve the first match with potentially bad performance.
We currently have getBlobEntryFirst that takes a filter on the label and returns the first match, similar to findfirst followed by a get or getBlobEntries[1] (with a filter)
Maybe use verb retrieve for findfirst + get verb combination.
With findall returning labels of matches and findfirst returning the first match or nothing.
From julia docs:
findfirst(A) Return the index or key of the first true value in A. Return nothing if no such value is found.
tasks:
- extra parameter / new verb / adjective
list + filter vs findall - no find, aliased, or no filter in ls.
get[Plural] + filter vs new verb
findfirst + get with get[Plural] or new verb
xref #1085
Whats necessary to close this ticket:
getfirstDetails
This issue is to discuss filters and find/search as functions and parameters on functions such as
listVariablesandgetVariablesWe can retrieve the objects or the labels with (We currently have filters on some
getandlistfunctions)get[Plural]returns a vector of object with optional filterlistreturns a vector of labels with optional filterfind[all]can be aliased tolistif we wantedfindfirstcan be used for a more efficientlist()[1](but list is not that expensive)The main difference in
findfirstandlistwill be the return type and error behaviour.listalways returns a vector while withfindfirstyou would want the first element in the vector andnothing(julia way) if empty.Then there is also
searchas an option, but I see that more for a bigger scope such as searching across all graphs in the DB.What I think is still missing is an efficient and clear
findfirstthengetWe can just use
get[Plural][1]to retrieve the first match with potentially bad performance.We currently have
getBlobEntryFirstthat takes a filter on the label and returns the first match, similar tofindfirstfollowed by agetorgetBlobEntries[1](with a filter)Maybe use verb
retrieveforfindfirst+getverb combination.With
findallreturning labels of matches andfindfirstreturning the first match or nothing.From julia docs:
tasks:
list+ filter vsfindall- no find, aliased, or no filter in ls.get[Plural]+ filter vs new verbfindfirst+getwithget[Plural]or newverbxref #1085