taoensso / faraday

Amazon DynamoDB client for Clojure
https://www.taoensso.com/faraday
Eclipse Public License 1.0
238 stars 84 forks source link

Accept keyword index names in scan and query fns #121

Closed GoWind closed 4 years ago

GoWind commented 6 years ago

do a (name index) in scan-request and query-request fns so that the index names can be keywords.

ptaoussanis commented 6 years ago

Hi Govind, thanks for this!

Could you please provide some more context/motivation? Is this an enhancement? A fix for something?

Much appreciated, cheers :-)

GoWind commented 6 years ago

I feel it is idiomatic with respect to the general interface of the library. The put-item fn accept a keyword or a string as an argument for the table's name ((faraday/put-item client :table-name) and (faraday/put-item client "table-name") are equivalent). Keywords as names of indexes is also prevalent. For e.g.,

(fr/create-table 
  client 
  :table-a
  [:name :s]
 {:gsindexes [{:name :index-a
               :throughput {:read 5 :write 5}
               :hash-keydef [:type :s]
               :projection :all}])

So intuitively, I expected the scan and query fns to accept a keyword index name when I was using the library and ran into exceptions as the .setIndexName method expects a string but got a keyword instead. It is a rather minor enhancement, but I feel that allowing keywords for index names would make the library's APIs more consistent.

belucid commented 5 years ago

@GoWind and @ptaoussanis I'm looking into this one now. More soon.

joelittlejohn commented 4 years ago

Yep, this one's a no-brainer. Thanks @GoWind !