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.
(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.
(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]
(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.
(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}.
(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.
(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.
(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:
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.
(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.
(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.
(subst-map<- variadic-parameter)
Convert a vector like found in a variadic parameter into a substitution map. Supported cases:
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.
(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:
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.
(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.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close