Liking cljdoc? Tell your friends :D

puppetlabs.puppetdb.query.paging

Paging query parameter manipulation

Functions that aid in the validation and processing of the query parameters related to paging PuppetDB queries

Paging query parameter manipulation

Functions that aid in the validation and processing of the
query parameters related to paging PuppetDB queries
raw docstring

coerce-to-intclj

(coerce-to-int i)

Parses the int unless it's already an int

Parses the int unless it's already an int
sourceraw docstring

count-headerclj

source

dealias-order-byclj

(dealias-order-by {:keys [projections] :as _query-rec} paging-options)
source

munge-query-orderingclj

(munge-query-ordering clauses)
source

parse-explainclj

(parse-explain explain)

Inputs: [explain :- (s/maybe String)] Returns: (s/maybe s/Keyword)

Parse the optional explain query parameter. Returns a keyword explain upon successful validation. Throws an exception if provided explain is not a valid string

Inputs: [explain :- (s/maybe String)]
Returns: (s/maybe s/Keyword)

Parse the optional `explain` query parameter. Returns a keyword
`explain` upon successful validation. Throws an exception if provided `explain` is
not a valid string
sourceraw docstring

parse-limitclj

(parse-limit limit)

Inputs: [limit :- (s/maybe (s/cond-pre String s/Int))] Returns: (s/maybe s/Int)

Parse the optional limit query parameter. Returns an integer version of limit upon successful validation. Throws an exception if provided limit is not a positive integer

Inputs: [limit :- (s/maybe (s/cond-pre String s/Int))]
Returns: (s/maybe s/Int)

Parse the optional `limit` query parameter. Returns an integer version of
`limit` upon successful validation. Throws an exception if provided `limit` is
not a positive integer
sourceraw docstring

parse-offsetclj

(parse-offset offset)

Parse the optional offset query parameter in the paging options map, and return an updated map with the correct integer value. Throws an exception if the provided offset is not a non-negative integer.

Parse the optional `offset` query parameter in the paging options map,
and return an updated map with the correct integer value. Throws an exception
if the provided offset is not a non-negative integer.
sourceraw docstring

parse-order-byclj

(parse-order-by order-by)

Given a list of order-by clauses that conform to the PuppetDB paging API, validate and convert the order-by to our internal format. Incoming is of the form:

{ :field String (s/optional-key :order) String }

outgoing is of the form:

[ (s/one s/Keyword "field-name") (s/one (s/enum :ascending :descending) "sort-order") ]

Not applying schema here until the original parse-order-by fn is replaced by this one. There are tests that require bad input parameters to be handled properly inside this function

If validation fails, this function will throw an exception with an informative error message as to the cause of the failure.

Given a list of order-by clauses that conform to the PuppetDB paging API,
validate and convert the order-by to our internal format. Incoming is of the
form:

  {
    :field String
    (s/optional-key :order) String
  }

outgoing is of the form:

  [
    (s/one s/Keyword "field-name")
    (s/one (s/enum :ascending :descending) "sort-order")
  ]

Not applying schema here until the original parse-order-by fn is replaced by
this one. There are tests that require bad input parameters to be handled
properly inside this function

If validation fails, this function will throw an exception with an informative
error message as to the cause of the failure.
sourceraw docstring

parse-order-by-jsonclj

(parse-order-by-json order_by)

Parses a JSON order_by string. Returns the parsed string, or a Ring error response with a useful error message if there was a parse failure.

Parses a JSON order_by string. Returns the parsed string, or a Ring error
response with a useful error message if there was a parse failure.
sourceraw docstring

parse-order-strclj

(parse-order-str order)

Given an 'order' string, returns either :ascending or :descending

Given an 'order' string, returns either :ascending or :descending
sourceraw docstring

parse-required-order-by-fieldsclj

(parse-required-order-by-fields order_by)

Validates that each map in the order_by list contains the required key ':field', and a legal value for the optional key ':order' if it is provided. Throws an exception with a useful error message if validation fails; otherwise, returns a list of order by expressions that satisfy order-by-expr?

Validates that each map in the order_by list contains the required
key ':field', and a legal value for the optional key ':order' if it
is provided.  Throws an exception with a useful error message
if validation fails; otherwise, returns a list of order by expressions
that satisfy `order-by-expr?`
sourceraw docstring

query-paramsclj

source

valid-order-str?clj

(valid-order-str? order)

Predicate that tests whether an 'order' string is valid; legal values are nil, 'asc', and 'desc' (case-insensitive).

Predicate that tests whether an 'order' string is valid; legal values are
nil, 'asc', and 'desc' (case-insensitive).
sourceraw docstring

valid-paging-options?clj

(valid-paging-options? {:keys [limit offset order_by] :as paging-options})

Predicate that tests whether an object represents valid paging options, based on the format that is generated by the wrap-with-paging-options middleware.

Predicate that tests whether an object represents valid paging options, based
on the format that is generated by the wrap-with-paging-options middleware.
sourceraw docstring

validate-explainclj

(validate-explain explain)

Validates that the explain string is a string containing analyze. Returns the keyword form if validation was successful, otherwise a bad-query-ex is thrown.

Validates that the explain string is a string containing `analyze`.  Returns
the keyword form if validation was successful, otherwise a bad-query-ex is
thrown.
sourceraw docstring

validate-limitclj

(validate-limit limit)

Validates that the limit string is a positive non-zero integer. Returns the integer form if validation was successful, otherwise a bad-query-ex is thrown.

Validates that the limit string is a positive non-zero integer. Returns the
integer form if validation was successful, otherwise a bad-query-ex is
thrown.
sourceraw docstring

validate-no-invalid-order-by-fieldsclj

(validate-no-invalid-order-by-fields order_by)

Validates that each map in the order_by list does not contain any invalid keys. Legal keys are ':field' and ':order'. Returns the input if validation was successful; throws an exception with a useful error message otherwise.

Validates that each map in the order_by list does not contain any invalid
keys.  Legal keys are ':field' and ':order'.  Returns the input if validation
was successful; throws an exception with a useful error message otherwise.
sourceraw docstring

validate-offsetclj

(validate-offset offset)

Validates that the offset string is a non-negative integer. Returns the integer form if validation was successful, otherwise a bad-query-ex is thrown.

Validates that the offset string is a non-negative integer.  Returns the
integer form if validation was successful, otherwise a bad-query-ex is
thrown.
sourceraw docstring

validate-order-by!clj

(validate-order-by! columns paging-options)

Given a list of keywords representing legal fields for ordering a query, and a map of paging options, validate that the order_by data in the paging options complies with the list of fields. Throws an exception if validation fails.

Given a list of keywords representing legal fields for ordering a query, and
a map of paging options, validate that the order_by data in the paging options
complies with the list of fields. Throws an exception if validation fails.
sourceraw docstring

validate-order-by-data-structureclj

(validate-order-by-data-structure order_by)

Validates an order_by data structure. The value must be nil, an empty list, or a list of maps. Returns the input if validation is successful, or a Ring error response with a useful error message if the validation fails.

Validates an order_by data structure.  The value must be `nil`, an empty list,
or a list of maps.  Returns the input if validation is successful, or a
Ring error response with a useful error message if the validation fails.
sourceraw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
Move to previous article
Move to next article
Ctrl+/Jump to the search field
× close