Skip to content

Instantly share code, notes, and snippets.

@rundis
Last active August 29, 2015 14:17
Show Gist options
  • Save rundis/2bd8954059af6bb8175a to your computer and use it in GitHub Desktop.
Save rundis/2bd8954059af6bb8175a to your computer and use it in GitHub Desktop.
nrepl find symbol extra space ?
;given store.clj with a function like
(defn find-user-by-id3 [conn id]
(when-let [user
(first
(jdbc/query conn ["select * from user where id = ?" id]))]
(assoc user :user-roles (find-user-roles conn (:id user)))))
; and a service.clj with a usage like
(defn refresh-auth-token [ds auth-conf refresh-token]
(if-let [unsigned (unsign-token auth-conf refresh-token)]
(jdbc/with-db-transaction [conn ds]
(let [db-token-rec (store/find-token-by-unq-key conn (:user-id unsigned) (:iat unsigned))
user (store/find-user-by-id3 conn (:user_id db-token-rec))]
(if (:valid db-token-rec)
(do
(store/invalidate-token! conn (:id db-token-rec))
[true (make-token-pair! conn auth-conf user)])
[false {:message "Refresh token revoked/deleted or new refresh token already created"}])))
[false {:message "Invalid or expired refresh token provided"}]))
; i do a find symbol search for find-user-by-id3 in store.clj I would get for the service.clj hit:
{:occurrence
(:line-beg 72
:line-end 72
:col-beg 19
:col-end 42
:name "acme-auth.store/find-user-by-id3"
:file "/Users/mrundberget/projects/rundis/acme-buddy/acme-auth/src/acme_auth/service.clj"
:match " user (store/find-user-by-id3 conn (:user_id db-token-rec))]")
:id 11445ff8-edd0-4c29-a0f6-5956bb2fb348}
;; ignoring the line part , col-end includes the space before the conn arg to the function
;; 'store/find-user-by-id3 '
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment