(alter-sequence seq-name opts)Constructs an ALTER SEQUENCE statement map for H2.
Arguments:
Options:
Examples: (alter-sequence :my_seq {:restart-with 500}) ;; => {:alter-sequence [:my_seq {:restart-with 500}]}
Constructs an ALTER SEQUENCE statement map for H2.
Arguments:
- seq-name: The sequence name (keyword or symbol)
- opts: Map of alter options
Options:
- :if-exists - Add IF EXISTS clause
- :restart - Restart the sequence
- :restart-with - Restart with specific value
- :increment-by - Change increment value
- :minvalue/:no-minvalue - Change minimum
- :maxvalue/:no-maxvalue - Change maximum
- :cycle/:no-cycle - Change cycling
- :cache/:no-cache - Change caching
Examples:
(alter-sequence :my_seq {:restart-with 500})
;; => {:alter-sequence [:my_seq {:restart-with 500}]}(boolean! v)Coerces a value to boolean with sophisticated type handling.
Conversion rules:
Coerces a value to boolean with sophisticated type handling. Conversion rules: - Boolean: returned as-is - nil: returns false - String: case-insensitive matching - Truthy: "true", "yes", "on", "1", "t", "y" - Falsy: "false", "no", "off", "0", "f", "n", "" (empty) - Whitespace-only strings: false - Other strings: false (strict mode - unknown strings are falsy) - Number: positive numbers are true, zero and negative are false - Collection: non-empty is true, empty is false - Other: truthy if non-nil (standard Clojure truthiness)
(create-sequence seq-name)(create-sequence seq-name opts)Constructs a CREATE SEQUENCE statement map for H2.
Arguments:
Options:
Examples: (create-sequence :my_seq) ;; => {:create-sequence :my_seq}
(create-sequence :my_seq {:start-with 100 :increment-by 10}) ;; => {:create-sequence [:my_seq {:start-with 100 :increment-by 10}]}
Constructs a CREATE SEQUENCE statement map for H2.
Arguments:
- seq-name: The sequence name (keyword or symbol)
- opts: Optional map of sequence options
Options:
- :if-not-exists - Add IF NOT EXISTS clause
- :as - Data type (e.g., :bigint, :int)
- :start-with - Starting value
- :increment-by - Increment value
- :minvalue - Minimum value
- :no-minvalue - Use NO MINVALUE
- :maxvalue - Maximum value
- :no-maxvalue - Use NO MAXVALUE
- :cycle - Enable cycling
- :no-cycle - Disable cycling
- :cache - Cache size
- :no-cache - Disable caching
Examples:
(create-sequence :my_seq)
;; => {:create-sequence :my_seq}
(create-sequence :my_seq {:start-with 100 :increment-by 10})
;; => {:create-sequence [:my_seq {:start-with 100 :increment-by 10}]}(currval seq-name)Constructs a CURRENT VALUE FOR expression for use in queries.
Arguments:
Examples: (currval :my_seq) ;; => [:current-value-for :my_seq]
;; In a query: {:select [[(currval :my_seq) :current_id]]} ;; => SELECT CURRENT VALUE FOR my_seq AS current_id
Constructs a CURRENT VALUE FOR expression for use in queries.
Arguments:
- seq-name: The sequence name (keyword or symbol)
Examples:
(currval :my_seq)
;; => [:current-value-for :my_seq]
;; In a query:
{:select [[(currval :my_seq) :current_id]]}
;; => SELECT CURRENT VALUE FOR my_seq AS current_id(drop-sequence seq-name)(drop-sequence seq-name opts)Constructs a DROP SEQUENCE statement map for H2.
Arguments:
Examples: (drop-sequence :my_seq) ;; => {:drop-sequence :my_seq}
(drop-sequence :my_seq {:if-exists true}) ;; => {:drop-sequence [:my_seq {:if-exists true}]}
Constructs a DROP SEQUENCE statement map for H2.
Arguments:
- seq-name: The sequence name (keyword or symbol)
- opts: Optional map with :if-exists
Examples:
(drop-sequence :my_seq)
;; => {:drop-sequence :my_seq}
(drop-sequence :my_seq {:if-exists true})
;; => {:drop-sequence [:my_seq {:if-exists true}]}(listagg expr
&
{:keys [separator distinct on-overflow within-group filter over]})Constructs a LISTAGG aggregate expression for H2.
Arguments:
Options (keyword arguments):
Examples: (listagg :name) ;; => [:listagg :name]
(listagg :name :separator ", " :distinct true) ;; => [:listagg-distinct :name ", "]
(listagg :name :separator ", " :within-group {:order-by [:name]}) ;; => [:within-group [:listagg :name ", "] {:order-by [:name]}]
(listagg :name :separator ", " :on-overflow [:truncate "..." :with-count] :within-group {:order-by [:name]} :filter [:= :active true]) ;; Full expression with all clauses
Constructs a LISTAGG aggregate expression for H2.
Arguments:
- expr: The expression to aggregate (required)
Options (keyword arguments):
- :separator - String separator between values (default: none)
- :distinct - If true, use DISTINCT (default: false)
- :on-overflow - Overflow handling:
- :error -> ON OVERFLOW ERROR
- [:truncate] -> ON OVERFLOW TRUNCATE
- [:truncate "..."] -> ON OVERFLOW TRUNCATE '...'
- [:truncate "..." :with-count] -> ON OVERFLOW TRUNCATE '...' WITH COUNT
- [:truncate "..." :without-count] -> ON OVERFLOW TRUNCATE '...' WITHOUT COUNT
- :within-group - Order specification map, e.g., {:order-by [:name]}
- :filter - Filter condition, e.g., [:= :active true]
- :over - Window specification, e.g., {:partition-by [:dept]}
Uses HoneySQL syntax: [:over [[expr window-spec]]]
Examples:
(listagg :name)
;; => [:listagg :name]
(listagg :name :separator ", " :distinct true)
;; => [:listagg-distinct :name ", "]
(listagg :name :separator ", " :within-group {:order-by [:name]})
;; => [:within-group [:listagg :name ", "] {:order-by [:name]}]
(listagg :name
:separator ", "
:on-overflow [:truncate "..." :with-count]
:within-group {:order-by [:name]}
:filter [:= :active true])
;; Full expression with all clauses(nextval seq-name)Constructs a NEXT VALUE FOR expression for use in queries.
Arguments:
Examples: (nextval :my_seq) ;; => [:next-value-for :my_seq]
;; In a query: {:select [[(nextval :my_seq) :id]]} ;; => SELECT NEXT VALUE FOR my_seq AS id
Constructs a NEXT VALUE FOR expression for use in queries.
Arguments:
- seq-name: The sequence name (keyword or symbol)
Examples:
(nextval :my_seq)
;; => [:next-value-for :my_seq]
;; In a query:
{:select [[(nextval :my_seq) :id]]}
;; => SELECT NEXT VALUE FOR my_seq AS idcljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |