This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns app.crux.scylla | |
(:require [crux.codec :as codec] | |
[crux.db] | |
[crux.document-store :as ds] | |
[crux.io :refer [with-nippy-thaw-all]] | |
[crux.system :as sys] | |
[crux.memory] | |
[taoensso.nippy :as nippy] | |
[taoensso.timbre :as log] | |
[qbits.alia :as alia] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(put {:crux.db/id {[:user/id 1] :login-details} :user/id 1 :user/name "foo" :user/password "bar"}) | |
(put {:crux.db/id {[:user/id 1] :favorites} :user/id 1 :user/favorite-food "pie" :user/favorite-animal "cow"}) | |
(defn attr [ident attr] | |
(dissoc (crux/entity (db) {ident attr}) :crux.db/id)) | |
(defn entity [ident] | |
(let [[table id] ident] | |
(dissoc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#[proc_macro_attribute] | |
pub fn instrument_err(args: TokenStream, item: TokenStream) -> TokenStream { | |
let input: ItemFn = syn::parse_macro_input!(item as ItemFn); | |
let args = syn::parse_macro_input!(args as AttributeArgs); | |
// these are needed ahead of time, as ItemFn contains the function body _and_ | |
// isn't representable inside a quote!/quote_spanned! macro | |
// (Syn's ToTokens isn't implemented for ItemFn) | |
let ItemFn { | |
attrs, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun insert-parentheses-backward () | |
"Insert parentheses around the sexp near point. | |
Move parentheses backward by sexp if used repeatedly." | |
(interactive) | |
(cond ((string-match-p "\\\w" (char-to-string (char-after))) | |
(forward-char) (insert-parentheses-backward)) | |
((equal (char-before) 41) | |
(backward-sexp) (insert-parentheses-backward)) | |
((equal (char-after) 40) | |
(if (equal (char-before) 40) |
NewerOlder