SQLRat / src / main / clj / org / bituf / sqlrat / clause / internal.clj

(ns org.bituf.sqlrat.clause.internal
  (:use org.bituf.sqlrat.util))


;; ======== Clause meta data ========

(def clause-key :sqlrat-sql-clause?)


(def clause-meta {clause-key true})


(defn assoc-clause-meta "Add clause meta data to specified object"
  [obj]
  (with-meta obj (merge (meta obj) clause-meta)))


;; ======== Keyword to String conversion ========

(defn str-name
  "Convert keyword/anything to a string (colname)."
  [k]
  (if (keyword? k) (name k)
    (str k)))

(defn str-clause-key
  "Convert a clause keyword to string.
   :where becomes \" WHERE \"
   :group-by becomes \" GROUP BY \"
   and so on."
  [clause-key key-prefix]
  (if *assert-args* (assert (keyword? clause-key)))
  (.toUpperCase
    (.replace
      (str key-prefix
        (name clause-key) \  )
      \- \  )))
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.