Skip to content

Instantly share code, notes, and snippets.

@mpenet
Last active October 16, 2018 16:59
Show Gist options
  • Save mpenet/5141349 to your computer and use it in GitHub Desktop.
Save mpenet/5141349 to your computer and use it in GitHub Desktop.
playing with hayt api
{:drop-index :foo}
{:drop-keyspace :foo}
{:drop-table :foo}
{:select (#qbits.hayt.cql.CQLFn{:name COUNT, :args (:*)}), :from :foo}
{:select (:*), :from :foo, :where {:ts #qbits.hayt.cql.CQLFn{:name now, :args nil}}}
{:select (#qbits.hayt.cql.CQLFn{:name WRITETIME, :args (:bar)}), :from :foo}
{:select (#qbits.hayt.cql.CQLFn{:name TTL, :args (bar)}), :from :foo}
{:select (#qbits.hayt.cql.CQLFn{:name unixTimestampOf, :args (bar)} #qbits.hayt.cql.CQLFn{:name dateOf, :args (:bar)}), :from :foo}
{:select (:*), :from :foo, :where {#qbits.hayt.cql.CQLFn{:name token, :args (:user-id)} [#<core$_GT_ clojure.core$_GT_@6177060f> #qbits.hayt.cql.CQLFn{:name token, :args (tom)}]}}
{:select (:*), :from :foo, :where {:ts #qbits.hayt.cql.CQLFn{:name now, :args nil}}}
{:select (:*), :from :foo, :where {#qbits.hayt.cql.CQLFn{:name token, :args (:user-id)} [#<core$_GT_ clojure.core$_GT_@6177060f> #qbits.hayt.cql.CQLFn{:name token, :args (tom)}]}}
{:select (:*), :from :foo, :where [[:ts [#<core$_GT_ clojure.core$_GT_@6177060f> #qbits.hayt.cql.CQLFn{:name maxTimeuuid, :args (0)}]] [:ts [#<core$_LT_ clojure.core$_LT_@5454570a> #qbits.hayt.cql.CQLFn{:name minTimeuuid, :args (0)}]]]}
{:select (:foo), :columns (:bar baz)}
{:select (:foo), :columns (:bar baz)}
{:insert :foo, :values {c d, :a b}}
{:insert :foo, :values {c d, :a b}, :using {:timestamp 100000, :ttl 200000}}
{:create-table :foo, :column-definitions {:primary-key :a, :a :varchar, :b :int}}
{:create-table :foo, :column-definitions {:primary-key [:foo :bar], :foo :varchar, :bar :int}}
{:create-table :foo, :column-definitions {:primary-key [:foo :bar], :foo :varchar, :bar :int}, :with {:clustering-order [[:bar :asc]], :compact-storage true}}
{:truncate :foo}
{:select (:*), :from :foo}
{:from :foo, :select :*}
{:select (:bar baz), :from :foo}
{:select (:bar baz), :from :foo, :limit 100, :allow-filtering true}
{:select (:*), :from :foo, :order-by ([:bar :desc])}
{:select (:*), :from :foo, :where {:foo :bar, :moo [#<core$_GT_ clojure.core$_GT_@6177060f> 3], :meh [:> 4], :baz [:in [5 6 7]]}}
{:select (:*), :from :foo, :where [[:foo [#<core$_GT_ clojure.core$_GT_@6177060f> 1]] [:foo [#<core$_LT_ clojure.core$_LT_@5454570a> 10]]]}
{:select (:*), :from :foo, :where {:foo :bar, :moo [#<core$_GT_ clojure.core$_GT_@6177060f> 3], :meh [:> 4], :baz [:in [5 6 7]]}}
{:delete ({:bar 2}), :from :foo, :where {:baz 1}}
{:delete ({:bar 2}), :from :foo, :where {:baz 1}}
{:delete (:*), :from :foo, :using {:timestamp 100000, :ttl 200000}, :where {:foo :bar, :moo [#<core$_GT_ clojure.core$_GT_@6177060f> 3], :meh [:> 4], :baz [:in [5 6 7]]}}
{:grant :FULL_ACCESS, :to :baz, :on :bar}
{:revoke :FULL_ACCESS, :from :baz, :on :bar}
{:create-user :foo, :superuser false, :with-password :bar}
{:create-user :foo, :superuser true, :with-password :bar}
{:alter-user :foo, :superuser false, :with-password :bar}
{:alter-user :foo, :superuser true, :with-password :bar}
{:drop-user :foo}
{:list-users nil}
{:list-permission :ALL, :recursive true, :on :bar, :of :baz}
{:list-permission :ALTER, :recursive false, :on :bar, :of :baz}
{:alter-column-family :foo, :alter-column (:bar :int)}
{:alter-column-family :foo, :alter-column (:bar :int), :rename-column (:foo :bar), :add-column (:baz :text)}
{:alter-column-family :foo, :alter-column (:bar :int), :add-column (:baz :text), :with {:clustering-order [[:bar :asc]], :compact-storage true}}
{:select (:*), :from :foo, :where {:a :a1, :c :c1, :b :b1}}
{:update :foo, :set-columns {:bar 1, :baz [#<core$_PLUS_ clojure.core$_PLUS_@1ae3e881> 2]}}
{:update :foo, :set-columns {:bar 1, :baz [#<core$_PLUS_ clojure.core$_PLUS_@1ae3e881> 2]}, :where {:foo :bar, :moo [#<core$_GT_ clojure.core$_GT_@6177060f> 3], :meh [:> 4], :baz [:in [5 6 7]]}}
{:update :foo, :set-columns {:bar 1, :baz [#<core$_PLUS_ clojure.core$_PLUS_@1ae3e881> {key value}]}, :where {:foo :bar}}
{:update :foo, :set-columns {:baz [[prepended] #<core$_PLUS_ clojure.core$_PLUS_@1ae3e881>]}, :where {:foo :bar}}
{:update :foo, :set-columns {:bar 1, :baz [#<core$_PLUS_ clojure.core$_PLUS_@1ae3e881> 2]}}
{:update :foo, :set-columns {:bar 1, :baz [#<core$_PLUS_ clojure.core$_PLUS_@1ae3e881> 2]}, :where {:foo :bar, :moo [#<core$_GT_ clojure.core$_GT_@6177060f> 3], :meh [:> 4], :baz [:in [5 6 7]]}}
{:batch ({:update :foo, :set-columns {:bar 1, :baz [#<core$_PLUS_ clojure.core$_PLUS_@1ae3e881> 2]}} {:insert :foo, :values {a b, c d}, :using {:timestamp 100000, :ttl 200000}}), :logged true, :using {:timestamp 2134}}
{:update :foo, :set-columns {:bar 1, :baz [#<core$_PLUS_ clojure.core$_PLUS_@1ae3e881> 2]}}
{:insert :foo, :values {a b, c d}, :using {:timestamp 100000, :ttl 200000}}
{:batch ({:update :foo, :set-columns {:bar 1, :baz [#<core$_PLUS_ clojure.core$_PLUS_@1ae3e881> 2]}} {:insert :foo, :values {a b, c d}, :using {:timestamp 100000, :ttl 200000}}), :logged false, :using {:timestamp 2134}}
{:update :foo, :set-columns {:bar 1, :baz [#<core$_PLUS_ clojure.core$_PLUS_@1ae3e881> 2]}}
{:insert :foo, :values {a b, c d}, :using {:timestamp 100000, :ttl 200000}}
{:batch ({:update :foo, :set-columns {:bar 1, :baz [#<core$_PLUS_ clojure.core$_PLUS_@1ae3e881> 2]}} {:insert :foo, :values {a b, c d}, :using {:timestamp 100000, :ttl 200000}}), :logged true, :counter true, :using {:timestamp 1234}}
{:update :foo, :set-columns {:bar 1, :baz [#<core$_PLUS_ clojure.core$_PLUS_@1ae3e881> 2]}}
{:insert :foo, :values {a b, c d}, :using {:timestamp 100000, :ttl 200000}}
{:create-keyspace :foo, :with {:replication {:class SimpleStrategy, :replication_factor 3}}}
{:create-keyspace :foo, :with {:durable_writes true}}
{:alter-keyspace :foo, :with {:something-else foo, :something 1, :replication {:class SimpleStrategy, :replication_factor 3}}}
{:insert :foo, :values {c d, :a b}, :using {:timestamp 100000, :ttl 200000}}
{:insert :foo, :values {c d, :a b}, :using {:timestamp 100000, :ttl 200000}}
{:use-keyspace :foo}
{:create-index :bar, :on :foo}
{:create-index :bar, :on :foo, :index-name baz}
{:alter-table :foo, :alter-column (:bar :int)}
{:alter-table :foo, :alter-column (:bar :int), :add-column (:baz :text), :rename-column (:foo :bar)}
{:alter-table :foo, :alter-column (:bar :int), :add-column (:baz :text), :with {:clustering-order [[:bar :asc]], :compact-storage true}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment