(batch-get-item requests & {:keys nil :as opts})
Retrieves a batch of items in a single request. Limits apply, Ref. http://goo.gl/Bj9TC.
(batch-get-item client-opts {:users {:prim-kvs {:name "alice"}} :posts {:prim-kvs {:id [1 2 3]} :attrs [:timestamp :subject] :consistent? true} :friends {:prim-kvs [{:catagory "favorites" :id [1 2 3]} {:catagory "recent" :id [7 8 9]}]}})
:span-reqs - {:max _ :throttle-ms _} allows a number of requests to automatically be stitched together (to exceed throughput limits, for example).
Retrieves a batch of items in a single request. Limits apply, Ref. http://goo.gl/Bj9TC. (batch-get-item client-opts {:users {:prim-kvs {:name "alice"}} :posts {:prim-kvs {:id [1 2 3]} :attrs [:timestamp :subject] :consistent? true} :friends {:prim-kvs [{:catagory "favorites" :id [1 2 3]} {:catagory "recent" :id [7 8 9]}]}}) :span-reqs - {:max _ :throttle-ms _} allows a number of requests to automatically be stitched together (to exceed throughput limits, for example).
(batch-write-item requests & {:keys nil :as opts})
Executes a batch of Puts and/or Deletes in a single request. Limits apply, Ref. http://goo.gl/Bj9TC. No transaction guarantees are provided, nor conditional puts. Request execution order is undefined.
(batch-write-item client-opts {:users {:put [{:user-id 1 :username "sally"} {:user-id 2 :username "jane"}] :delete [{:user-id [3 4 5]}]}})
:span-reqs - {:max _ :throttle-ms _} allows a number of requests to automatically be stitched together (to exceed throughput limits, for example).
Executes a batch of Puts and/or Deletes in a single request. Limits apply, Ref. http://goo.gl/Bj9TC. No transaction guarantees are provided, nor conditional puts. Request execution order is undefined. (batch-write-item client-opts {:users {:put [{:user-id 1 :username "sally"} {:user-id 2 :username "jane"}] :delete [{:user-id [3 4 5]}]}}) :span-reqs - {:max _ :throttle-ms _} allows a number of requests to automatically be stitched together (to exceed throughput limits, for example).
(create-table table-name hash-keydef & {:keys nil :as opts})
Creates a table with options: hash-keydef - [<name> <#{:s :n :ss :ns :b :bs}>]. :range-keydef - [<name> <#{:s :n :ss :ns :b :bs}>]. :throughput - {:read <units> :write <units>}. :lsindexes - [{:name _ :range-keydef _ :projection #{:all :keys-only [<attr> ...]}}]. :gsindexes - [{:name _ :hash-keydef _ :range-keydef _ :projection #{:all :keys-only [<attr> ...]} :throughput _}]. :block? - Block for table to actually be active?
Additional examples (using dynolite) :
(dl/create-table :employee1 [:site-uid :s]
:range-keydef [:uid :s]
:gsindexes [{:name :fname-index :hash-keydef [:emailAddress :s]
:range-keydef [:familyName :s]
:projection [:firstName :paymentSchedule :phoneNumber :dateEmployment]
:throughput {:read 1 :write 1}}])
(dl/create-table :employee [:site-uid :s]
:range-keydef [:uid :s]
:lsindexes [{:name :family-name-index :range-keydef [:familyName :s]
:projection [:firstName :emailAddress :phoneNumber :dateEmployment]}])
Creates a table with options: hash-keydef - [<name> <#{:s :n :ss :ns :b :bs}>]. :range-keydef - [<name> <#{:s :n :ss :ns :b :bs}>]. :throughput - {:read <units> :write <units>}. :lsindexes - [{:name _ :range-keydef _ :projection #{:all :keys-only [<attr> ...]}}]. :gsindexes - [{:name _ :hash-keydef _ :range-keydef _ :projection #{:all :keys-only [<attr> ...]} :throughput _}]. :block? - Block for table to actually be active? Additional examples (using dynolite) : (dl/create-table :employee1 [:site-uid :s] :range-keydef [:uid :s] :gsindexes [{:name :fname-index :hash-keydef [:emailAddress :s] :range-keydef [:familyName :s] :projection [:firstName :paymentSchedule :phoneNumber :dateEmployment] :throughput {:read 1 :write 1}}]) (dl/create-table :employee [:site-uid :s] :range-keydef [:uid :s] :lsindexes [{:name :family-name-index :range-keydef [:familyName :s] :projection [:firstName :emailAddress :phoneNumber :dateEmployment]}])
(defalias name orig)
(defalias name orig doc)
Defines an alias for a var: a new var with the same root binding (if any) and similar metadata. The metadata of the alias is its initial metadata (as provided by def) merged into the metadata of the original.
Defines an alias for a var: a new var with the same root binding (if any) and similar metadata. The metadata of the alias is its initial metadata (as provided by def) merged into the metadata of the original.
(delete-item table prim-kvs & {:keys nil :as opts})
Deletes an item from a table by its primary key.
See put-item
for option docs.
Deletes an item from a table by its primary key. See `put-item` for option docs.
(delete-table table)
(describe-table table)
Returns a map describing a table, or nil if the table doesn't exist.
Returns a map describing a table, or nil if the table doesn't exist.
(ensure-table table-name hash-keydef & opts)
Creates a table iff it doesn't already exist.
Creates a table iff it doesn't already exist.
(get-item table prim-kvs & {:keys nil :as opts})
Retrieves an item from a table by its primary key with options: prim-kvs - {<hash-key> <val>} or {<hash-key> <val> <range-key> <val>}. :attrs - Attrs to return, [<attr> ...]. :consistent? - Use strongly (rather than eventually) consistent reads? :alias-attr-name-map - {<alias> <attr>}, that can be used in :projection-attrs :projection-attrs - [<attr> ...]
Additional examples (using dynolite) :
(dl/get-item :employee {:site-id "4w", :id "yVSEkgAb9dDWtA"} :alias-attr-name-map {:fn :firstName :sn :familyName :e :emailAddress :p :phoneNumber :d :dateEmployment :t :terminatedP :i :id} :projection-attrs [:fn :sn :e :p :d :t :i])
Retrieves an item from a table by its primary key with options: prim-kvs - {<hash-key> <val>} or {<hash-key> <val> <range-key> <val>}. :attrs - Attrs to return, [<attr> ...]. :consistent? - Use strongly (rather than eventually) consistent reads? :alias-attr-name-map - {<alias> <attr>}, that can be used in :projection-attrs :projection-attrs - [<attr> ...] Additional examples (using dynolite) : (dl/get-item :employee {:site-id "4w", :id "yVSEkgAb9dDWtA"} :alias-attr-name-map {:fn :firstName :sn :familyName :e :emailAddress :p :phoneNumber :d :dateEmployment :t :terminatedP :i :id} :projection-attrs [:fn :sn :e :p :d :t :i])
(hub-fn->lite-fn fn-name)
(hub-fns->lite-fns fn-name-list & args)
(list-tables)
Returns a vector of table names.
Returns a vector of table names.
(put-item table item & {:keys nil :as opts})
Adds an item (Clojure map) to a table with options: :return - e/o #{:none :all-old}. :expected - A map of item attribute/condition pairs, all of which must be met for the operation to succeed. e.g.: {<attr> <expected-value> ...} {<attr> false ...} ; Attribute must not exist
Adds an item (Clojure map) to a table with options: :return - e/o #{:none :all-old}. :expected - A map of item attribute/condition pairs, all of which must be met for the operation to succeed. e.g.: {<attr> <expected-value> ...} {<attr> false ...} ; Attribute must not exist
(query table prim-key-conds & {:keys nil :as opts})
Retrieves items from a table (indexed) with options: prim-key-conds - {<key-attr> [<comparison-operator> <val-or-vals>] ...}. :last-prim-kvs - Primary key-val from which to eval, useful for paging. :query-filter - {<key-attr> [<comparison-operator> <val-or-vals>] ...}. :logical-op - A logical operator to apply to :query-filter, #{:and :or} :span-reqs - {:max _ :throttle-ms _} controls automatic multi-request stitching. :return - e/o #{:all-attributes :all-projected-attributes :count [<attr> ...]}. :index - Name of a local or global secondary index to query. :order - Index scaning order e/o #{:asc :desc}. :limit - Max num >=1 of items to eval (≠ num of matching items). Useful to prevent harmful sudden bursts of read activity. :consistent? - Use strongly (rather than eventually) consistent reads? :alias-attr-name-map - {<alias> <attr>}, that can be used in filter-exp and projection-attrs. :alias-attr-value-map - {<alias> <val>}, that can be used in filter-exp. :projection-attrs - [<attr> ...] :filter-exp - Prefixed expression with: #{:= :<> :< :<= :> :>= :and :or :not :exists :not-exists :begins-with :contains :between :in} For available comparators and functions, see http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.SpecifyingConditions.html#ConditionExpressionReference
Note: the newly added :alias-attr-name-map, :alias-attr-value-map, :filter-exp, and :projection-attrs are Amazon's preferred way of doing filtering. Only one of query-filter or filter-exp has to exist in a query/scan.
(create-table client-opts :my-table [:name :s] {:range-keydef [:age :n] :block? true})
(do (put-item client-opts :my-table {:name "Steve" :age 24}) (put-item client-opts :my-table {:name "Susan" :age 27})) (query client-opts :my-table {:name [:eq "Steve"] :age [:between [10 30]]}) => [{:age 24, :name "Steve"}]
The old style comparison-operators e/o #{:eq :le :lt :ge :gt :begins-with :between}.
For unindexed item retrievel see scan
.
Ref. http://goo.gl/XfGKW for query+scan best practices.
Additional examples (using dynolite) :
(dl/query :employee {:site-uid [:eq "4w"]} :query-filter {:phoneNumber :not-null})
(dl/query :employee {:site-uid [:eq "4w"]} :query-filter {:emailAddress [:contains "Super"]} :limit 10)
(dl/query :employee {:site-id [:eq "4w"]}
:exp-attr-name-map {"#f" "firstName" "#s" "site-id"}
:exp-attr-val-map {":fn" "Louis" ":id" "4w"}
:filter-exp "#f = :fn AND #s = :id")
(dl/query :employee {:site-id [:eq "4w"]}
:index :family-name-index
:alias-attr-name-map {:fn :firstName :sn :familyName :e :emailAddress
:p :phoneNumber :d :dateEmployment :t :terminatedP :a :active?}
:alias-attr-value-map {:active true}
:projection-attrs [:fn :sn :e :p :d :t :id]
:filter-exp [:= :a :active])
Retrieves items from a table (indexed) with options: prim-key-conds - {<key-attr> [<comparison-operator> <val-or-vals>] ...}. :last-prim-kvs - Primary key-val from which to eval, useful for paging. :query-filter - {<key-attr> [<comparison-operator> <val-or-vals>] ...}. :logical-op - A logical operator to apply to :query-filter, #{:and :or} :span-reqs - {:max _ :throttle-ms _} controls automatic multi-request stitching. :return - e/o #{:all-attributes :all-projected-attributes :count [<attr> ...]}. :index - Name of a local or global secondary index to query. :order - Index scaning order e/o #{:asc :desc}. :limit - Max num >=1 of items to eval (≠ num of matching items). Useful to prevent harmful sudden bursts of read activity. :consistent? - Use strongly (rather than eventually) consistent reads? :alias-attr-name-map - {<alias> <attr>}, that can be used in filter-exp and projection-attrs. :alias-attr-value-map - {<alias> <val>}, that can be used in filter-exp. :projection-attrs - [<attr> ...] :filter-exp - Prefixed expression with: #{:= :<> :< :<= :> :>= :and :or :not :exists :not-exists :begins-with :contains :between :in} For available comparators and functions, see http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.SpecifyingConditions.html#ConditionExpressionReference Note: the newly added :alias-attr-name-map, :alias-attr-value-map, :filter-exp, and :projection-attrs are Amazon's preferred way of doing filtering. Only one of query-filter or filter-exp has to exist in a query/scan. (create-table client-opts :my-table [:name :s] {:range-keydef [:age :n] :block? true}) (do (put-item client-opts :my-table {:name "Steve" :age 24}) (put-item client-opts :my-table {:name "Susan" :age 27})) (query client-opts :my-table {:name [:eq "Steve"] :age [:between [10 30]]}) => [{:age 24, :name "Steve"}] The old style comparison-operators e/o #{:eq :le :lt :ge :gt :begins-with :between}. For unindexed item retrievel see `scan`. Ref. http://goo.gl/XfGKW for query+scan best practices. Additional examples (using dynolite) : (dl/query :employee {:site-uid [:eq "4w"]} :query-filter {:phoneNumber :not-null}) (dl/query :employee {:site-uid [:eq "4w"]} :query-filter {:emailAddress [:contains "Super"]} :limit 10) (dl/query :employee {:site-id [:eq "4w"]} :exp-attr-name-map {"#f" "firstName" "#s" "site-id"} :exp-attr-val-map {":fn" "Louis" ":id" "4w"} :filter-exp "#f = :fn AND #s = :id") (dl/query :employee {:site-id [:eq "4w"]} :index :family-name-index :alias-attr-name-map {:fn :firstName :sn :familyName :e :emailAddress :p :phoneNumber :d :dateEmployment :t :terminatedP :a :active?} :alias-attr-value-map {:active true} :projection-attrs [:fn :sn :e :p :d :t :id] :filter-exp [:= :a :active])
(scan table & {:keys nil :as opts})
Retrieves items from a table (unindexed) with options: :attr-conds - {<attr> [<comparison-operator> <val-or-vals>] ...}. :logical-op - A logical operator to apply to :attr-conds, #{:and :or} :limit - Max num >=1 of items to eval (≠ num of matching items). Useful to prevent harmful sudden bursts of read activity. :last-prim-kvs - Primary key-val from which to eval, useful for paging. :span-reqs - {:max _ :throttle-ms _} controls automatic multi-request stitching. :return - e/o #{:all-attributes :all-projected-attributes :count [<attr> ...]}. :total-segments - Total number of parallel scan segments. :segment - Calling worker's segment number (>=0, <=total-segments). :alias-attr-name-map - {<alias> <attr>}, that can be used in filter-exp and projection-attrs. :alias-attr-value-map - {<alias> <val>}, that can be used in filter-exp. :projection-attrs - [<attr> ...] :filter-exp - Prefixed expression with: #{:= :<> :< :<= :> :>= :and :or :not :exists :not-exists :begins-with :contains :between :in} For available comparators and functions, see http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.SpecifyingConditions.html#ConditionExpressionReference
Note: the newly added :alias-attr-name-map, :alias-attr-value-map, :filter-exp, and :projection-attrs are Amazon's preferred way of doing filtering. Only one of query-filter or filter-exp has to exist in a query/scan.
The old style comparison-operators e/o #{:eq :le :lt :ge :gt :begins-with :between :ne :not-null :null :contains :not-contains :in}.
(create-table client-opts :my-table [:name :s] {:range-keydef [:age :n] :block? true})
(do (put-item client-opts :my-table {:name "Steve" :age 24}) (put-item client-opts :my-table {:name "Susan" :age 27})) (scan client-opts :my-table :attr-conds {:age [:in [24 27]]}) => [{:age 24, :name "Steve"} {:age 27, :name "Susan"}]
For automatic parallelization & segment control see scan-parallel
.
For indexed item retrievel see query
.
Ref. http://goo.gl/XfGKW for query+scan best practices.
Additional examples (using dynolite) :
(dl/scan :employee :attr-conds {:emailAddress [:contains "Super"]} :limit 100)
(dl/scan :employee :attr-conds {:emailAddress :null})
(dl/scan :employee
:exp-attr-name-map {"#f" "firstName" "#s" "site-id"}
:exp-attr-val-map {":fn" "Louis" ":id" "4w"}
:filter-exp "#f = :fn AND #s = :id")
(dl/scan :employee
:index :family-name-index
:alias-attr-name-map {:fn :firstName :sn :familyName :e :emailAddress
:p :phoneNumber :d :dateEmployment :t :terminatedP :a :active?}
:alias-attr-value-map {:active true}
:projection-attrs [:fn :sn :e :p :d :t :id]
:filter-exp [:= :a :active])
Retrieves items from a table (unindexed) with options: :attr-conds - {<attr> [<comparison-operator> <val-or-vals>] ...}. :logical-op - A logical operator to apply to :attr-conds, #{:and :or} :limit - Max num >=1 of items to eval (≠ num of matching items). Useful to prevent harmful sudden bursts of read activity. :last-prim-kvs - Primary key-val from which to eval, useful for paging. :span-reqs - {:max _ :throttle-ms _} controls automatic multi-request stitching. :return - e/o #{:all-attributes :all-projected-attributes :count [<attr> ...]}. :total-segments - Total number of parallel scan segments. :segment - Calling worker's segment number (>=0, <=total-segments). :alias-attr-name-map - {<alias> <attr>}, that can be used in filter-exp and projection-attrs. :alias-attr-value-map - {<alias> <val>}, that can be used in filter-exp. :projection-attrs - [<attr> ...] :filter-exp - Prefixed expression with: #{:= :<> :< :<= :> :>= :and :or :not :exists :not-exists :begins-with :contains :between :in} For available comparators and functions, see http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.SpecifyingConditions.html#ConditionExpressionReference Note: the newly added :alias-attr-name-map, :alias-attr-value-map, :filter-exp, and :projection-attrs are Amazon's preferred way of doing filtering. Only one of query-filter or filter-exp has to exist in a query/scan. The old style comparison-operators e/o #{:eq :le :lt :ge :gt :begins-with :between :ne :not-null :null :contains :not-contains :in}. (create-table client-opts :my-table [:name :s] {:range-keydef [:age :n] :block? true}) (do (put-item client-opts :my-table {:name "Steve" :age 24}) (put-item client-opts :my-table {:name "Susan" :age 27})) (scan client-opts :my-table :attr-conds {:age [:in [24 27]]}) => [{:age 24, :name "Steve"} {:age 27, :name "Susan"}] For automatic parallelization & segment control see `scan-parallel`. For indexed item retrievel see `query`. Ref. http://goo.gl/XfGKW for query+scan best practices. Additional examples (using dynolite) : (dl/scan :employee :attr-conds {:emailAddress [:contains "Super"]} :limit 100) (dl/scan :employee :attr-conds {:emailAddress :null}) (dl/scan :employee :exp-attr-name-map {"#f" "firstName" "#s" "site-id"} :exp-attr-val-map {":fn" "Louis" ":id" "4w"} :filter-exp "#f = :fn AND #s = :id") (dl/scan :employee :index :family-name-index :alias-attr-name-map {:fn :firstName :sn :familyName :e :emailAddress :p :phoneNumber :d :dateEmployment :t :terminatedP :a :active?} :alias-attr-value-map {:active true} :projection-attrs [:fn :sn :e :p :d :t :id] :filter-exp [:= :a :active])
(set-default-client-opts opts)
(update-item table prim-kvs update-map & {:keys nil :as opts})
Updates an item in a table by its primary key with options: prim-kvs - {<hash-key> <val>} or {<hash-key> <val> <range-key> <val>}. update-map - {<attr> [<#{:put :add :delete}> <optional value>]}. :return - e/o #{:none :all-old :updated-old :all-new :updated-new}. :expected - {<attr> <#{<expected-value> false}> ...}.
Updates an item in a table by its primary key with options: prim-kvs - {<hash-key> <val>} or {<hash-key> <val> <range-key> <val>}. update-map - {<attr> [<#{:put :add :delete}> <optional value>]}. :return - e/o #{:none :all-old :updated-old :all-new :updated-new}. :expected - {<attr> <#{<expected-value> false}> ...}.
(update-table table throughput & {:keys nil :as opts})
(with-binary-reader-writer
[&
{:keys [writer reader]
:or {reader (quote ozjongwon.dynohub/*binary-reader*)
writer (quote ozjongwon.dynohub/*binary-writer*)}}]
&
body)
(without-binary-reader-writer [] & body)
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close