• (ensure-relation db name keys indexes)
If the database lacks the named relation, add it

0 Examples top

Log in to add / edit an example.

See Also top

Log in to add a see also.

Plus_12x12 Minus_12x12 Source clojure/contrib/datalog/database.clj:96 top

(defn ensure-relation
  "If the database lacks the named relation, add it"
  [db name keys indexes]
  (if-let [rel (db name)]
    (do
      (assert (= (:schema rel) (set keys)))
      db)
    (let [db1 (add-relation db name keys)]
      (reduce (fn [db key] (add-index db name key))
              db1
              indexes))))
Vars in clojure.contrib.datalog.database/ensure-relation: = assert defn fn if-let key keys let name reduce set
Used in 0 other vars

Comments top

No comments for ensure-relation. Log in to add a comment.