clojure - How do I store and retrieve friend roles in a SQL database? -
i'm not sure how store friend
roles in database. can either store string "#{::user}"
or store "user"
, transform on retrieval. former bad juju , i'm unsure how latter without making angels cry.
(ns foo.handler (:require [cemerick.friend :as friend] (cemerick.friend [workflows :as workflows] [credentials :as creds]))) ;; dummy in-memory user "database" (def users {"root" {:username "root" :password (creds/hash-bcrypt "admin") :roles #{::admin}} "jane" {:username "jane" :password (creds/hash-bcrypt "pw") :roles #{::user}}}) (derive ::admin ::user)
this how i'm doing it; i'm sure it's sorts of bad. please stop me. starting "user"
extracted database:
foo.handler> #{(keyword (str *ns* "/" "user"))} => #{:foo.handler/user}
Comments
Post a Comment