Back

select! (clj)

(source)

function

(select! connectable cols sql-params) (select! connectable cols sql-params opts)
Execute the SQL and params using `next.jdbc/plan` and (by default) return a vector of rows with just the selected columns. `(plan/select! ds [:id :name] ["select * from table"])` If the `cols` argument is a vector of columns to select, then it is applied as: `(into [] (map #(select-keys % cols)) (jdbc/plan ...))` Otherwise, the `cols` argument is used as a function and mapped over the raw result set as: `(into [] (map cols) (jdbc/plan ...))` The usual caveats apply about operations on a raw result set that can be done without realizing the whole row. Note: this allows for the following usage, which returns a vector of all the values for a single column: `(plan/select! ds :id ["select * from table"])` The result is a vector by default, but can be changed using the `:into` option to provide the initial data structure into which the selected columns are poured, e.g., `:into #{}`

Examples