com.borkdal.squirrel.definitions

add

multimethod

Adds a sub-entity to an entity, using record-type for dispatch:

(compile-sql
 (add
  (select (table-expression (table-name "t")))
  (column (value-expression "c"))))
  => "select c from t"

If a sequence is provided, the sequence entities will be added separately:

(compile-sql
 (add
  (select (table-expression (table-name "t")))
  [(column (value-expression "c1"))
   (column (value-expression "c2"))]))
  => "select c1, c2 from t"

Can also be used as a reducer:

(compile-sql
 (reduce add
         (select (table-expression (table-name "t")))
         [(column (value-expression "c1"))
          (column (value-expression "c2"))
          (column (value-expression "c3"))]))
  => "select c1, c2, c3 from t"

(Examples are using com.borkdal.squirrel.postgresql.language.)

compile-sql

multimethod

Compiles the given entity into an SQL string, using record-type for dispatch.

get-built-in-type-check-function-name

(get-built-in-type-check-function-name entity)

Return the function to use to check for a built-in entity type.

get-record-type-namespace-string

(get-record-type-namespace-string entity)

Returns the keyword namespace to use for the entity record type - is “type” for built-in types (i.e., :type/string), and *ns* for user-defined entities.

record-type

multimethod

Returns a qualified keyword identifying the record type of an entity, dispatching on type.