JanetDocsSourcePlaygroundI'm feeling luckyCommunityGitHub sign in

joy/db/find-by

joy


    function
    /usr/local/lib/janet/db/sqlite/db.janet on line 313, column 1

    (find-by table-name & args)

    Takes a table name and optional args and returns either nil or the 
    first row from the query.

    Example:

    (import db)

    (db/find-by :todo :where {:completed true} :order "name")

    # or

    (db/find-by :todo :where {:completed true} :order "name desc")

    => {:id 1 name "name" :completed true}


1 exampleSign in to add an example
Loading...
# From: https://codeberg.org/veqq/janetdocs/src/commit/54a964d1a35920af2655c4932a9b51379e8b9380/helpers.janet#L52

(defn current-account [request]
  (def login (get-in request [:session :login] ""))
  (joy/db/find-by :account :where {:login login}))
veqqqPlayground