Liking cljdoc? Tell your friends :D

clj-foundation.templates

Implements variable substitution into strings. Variables are specified in the form ${VAR}. Then, the map {:VAR "value"} substitutes "value" into the string in place of ${VAR}. Also, given a string s can return the names of the variables that must be resolved in s.

Implements variable substitution into strings.  Variables are specified in the form
${VAR}.  Then, the map {:VAR "value"} substitutes "value" into the string in place
of ${VAR}.  Also, given a string s can return the names of the variables that must be
resolved in s.
raw docstring

interpolation-varsclj

(interpolation-vars str)

Returns the variable names that are defined in the specified string.

Returns the variable names that are defined in the specified string.
sourceraw docstring

kv-vector<-clj

(kv-vector<- m)

Inputs: [m :- #:s{Keyword s/Any}] Returns: [s/Keyword s/Any]

Translate a map of Keywords -> anything to a vector in the form: [:key1 val1 :key2 val2 ... :keyn valn]

Inputs: [m :- #:s{Keyword s/Any}]
Returns: [s/Keyword s/Any]

Translate a map of Keywords -> anything to a vector in the form:
[:key1 val1 :key2 val2 ... :keyn valn]
sourceraw docstring

linesclj

(lines source)

Inputs: [source :- (types BufferedReader s/Str)] Returns: ISeq

Like clojure.core/line-seq but accepts String in addition to java.io.BufferedReader.

Inputs: [source :- (types BufferedReader s/Str)]
Returns: ISeq

Like clojure.core/line-seq but accepts String in addition to java.io.BufferedReader.
sourceraw docstring

parameter-list<-clj

(parameter-list<- parameter-source substitution-map & options)

Inputs: [parameter-source :- (types String clojure.lang.ASeq) substitution-map :- #:s{Any s/Any} & options :- [s/Any]] Returns: [s/Any]

Generates a parameter list seq with variable values in the order in which variables are encountered in variable-source using resolve-var.

A parameter source is either a template string or a seq of variables in the order in which their values must be applied to some future function.

If :partial-resolve true is specified in options, resolves as many variables as possible. Unresolved variables are returned as ${var-name}.

Inputs: [parameter-source :- (types String clojure.lang.ASeq) substitution-map :- #:s{Any s/Any} & options :- [s/Any]]
Returns: [s/Any]

Generates a parameter list seq with variable values in the order in which variables are
encountered in variable-source using resolve-var.

A parameter source is either a template string or a seq of variables in the order in
which their values must be applied to some future function.

If :partial-resolve true is specified in options, resolves as many
variables as possible.  Unresolved variables are returned as ${var-name}.
sourceraw docstring

parameters<-clj

(parameters<- template)

Inputs: [template :- s/Str] Returns: [s/Any]

Parse template string and return the parameter list variables in the order in which they are defined in the string.

Inputs: [template :- s/Str]
Returns: [s/Any]

Parse template string and return the parameter list variables in the order in
which they are defined in the string.
sourceraw docstring

partial-subst<-clj

(partial-subst<- variable-string & substitutions)

Like subst<- but returns a partially-substituted string if values cannot be resolved. Use interpolation-vars to discover what variables have not been substituted yet.

Like subst<- but returns a partially-substituted string if values
cannot be resolved.  Use interpolation-vars to discover what variables
have not been substituted yet.
sourceraw docstring

resolve-varclj

(resolve-var default-substitutions var-name & options)

Inputs: [default-substitutions :- #:s{Any s/Any} var-name :- s/Keyword & options :- [s/Any]] Returns: s/Any

Resolves (template) variable values using the following precedence:

  • (System/getProperty)
  • (System/getenv)
  • default-substitutions map

Options are key/value pairs.

If Options contains :partial-resolve true, returns err/nothing if a variable cannot be resolved. Otherwise, if a variable cannot be resolved, throws ExceptionInfo.

Inputs: [default-substitutions :- #:s{Any s/Any} var-name :- s/Keyword & options :- [s/Any]]
Returns: s/Any

Resolves (template) variable values using the following precedence:

* (System/getProperty)
* (System/getenv)
* default-substitutions map

Options are key/value pairs.

If Options contains :partial-resolve true, returns err/nothing if a variable cannot
be resolved.  Otherwise, if a variable cannot be resolved, throws ExceptionInfo.
sourceraw docstring

seq->comma-stringclj

(seq->comma-string v)

Generally-useful function for turning a seq into a comma-separated string.

Generally-useful function for turning a seq into a comma-separated string.
sourceraw docstring

sql-varsclj

(sql-vars resource-string)

Inputs: [resource-string] Returns: [s/Str []]

Converts resource string using substitution-map into a tuple vector [String [binding arguments]] where the String is the SQL with binding question marks replacing the template variables and the binding arguments vector containing the variable name corresponding to each ? binding.

Inputs: [resource-string]
Returns: [s/Str []]

Converts resource string using substitution-map into a tuple vector [String [binding arguments]]
where the String is the SQL with binding question marks replacing the template variables and
the binding arguments vector containing the variable name corresponding to each ? binding.
sourceraw docstring

subst-map<-clj

(subst-map<- variadic-parameter)

Convert a vector like found in a variadic parameter into a substitution map. Supported cases:

  • The variadic parameter is empty -> return {}.
  • The variadic parameter contains a map -> return the map.
  • The variadic parameter is a sequence of keys and values -> convert to map.
Convert a vector like found in a variadic parameter into a substitution map.  Supported cases:

* The variadic parameter is empty -> return {}.
* The variadic parameter contains a map -> return the map.
* The variadic parameter is a sequence of keys and values -> convert to map.
sourceraw docstring

subst<-clj

(subst<- variable-string & substitutions)

Given a string containing variables of the form ${variable-name} and a map with keywords corresponding to the variable names/values where the values specified in the map represent default values to be used if the variable's value is not discovered via another method.

Values are derived (in the following order of precedence) from:

  • Java system properties
  • O/S environment variables
  • Values in substitution-map

If a value cannot be resolved, throws ExceptionInfo.

Given a string containing variables of the form ${variable-name}
and a map with keywords corresponding to the variable names/values
where the values specified in the map represent default values
to be used if the variable's value is not discovered via another
method.

Values are derived (in the following order of precedence) from:

* Java system properties
* O/S environment variables
* Values in substitution-map

If a value cannot be resolved, throws ExceptionInfo.
sourceraw docstring

try-resolve-varclj

(try-resolve-var substitutions var & options)

Inputs: [substitutions :- #:s{Keyword s/Any} var :- s/Keyword & options :- [s/Any]] Returns: s/Any

Resolve variable using resolve-var semantics. If :partial-resolve true is in options, unsuccessful variable resolutions are converted back to the variable's string representation and returned.

Inputs: [substitutions :- #:s{Keyword s/Any} var :- s/Keyword & options :- [s/Any]]
Returns: s/Any

Resolve variable using resolve-var semantics.  If :partial-resolve true is in options,
unsuccessful variable resolutions are converted back to the variable's string representation
and returned.
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close