Minor README update around raw

This commit is contained in:
Sean Corfield 2021-01-30 11:00:22 -08:00
parent 07eb66759a
commit d0f3068f3f

View file

@ -381,14 +381,13 @@ will not be lifted out as parameters, so they end up in the SQL string as-is.
Raw SQL can also be supplied as a vector of strings and values. Strings are Raw SQL can also be supplied as a vector of strings and values. Strings are
rendered as-is into the formatted SQL string. Non-strings are lifted as rendered as-is into the formatted SQL string. Non-strings are lifted as
parameters. If you need a string parameter lifted, you must use `:param` parameters. If you need a string parameter lifted, you must use `:param`.
or the `param` helper.
```clojure ```clojure
(-> (select :*) (-> (select :*)
(from :foo) (from :foo)
(where [:< :expired_at [:raw ["now() - '" 5 " seconds'"]]]) (where [:< :expired_at [:raw ["now() - '" 5 " seconds'"]]])
(sql/format {:foo 5})) (sql/format))
=> ["SELECT * FROM foo WHERE expired_at < now() - '? seconds'" 5] => ["SELECT * FROM foo WHERE expired_at < now() - '? seconds'" 5]
``` ```