napkin-runtime-2.0.0
Safe HaskellNone
LanguageGHC2024

Napkin.Parse.Interpolation.Mustache

Synopsis

Documentation

interpolate' :: forall {k} (b :: k) m. (MonadIO m, MustacheBackend b, InterpreterBackendSupport b) => InterpolationMode -> InterpreterInstance -> Proxy b -> SourceLocation -> Text -> SqlTemplateVariables -> m (Either InterpolationError Text) #

Substitutes variables in mustache template. Supports Haskell function interpolation in form of mustache sections.

Full list of supported sections:

  • sExp - generates SExp - almost any term in SQL syntax is SExp
  • queryExp - generates Query - full SQL query
  • strExp - generates String - will be inserted as is

interpolate #

Arguments

:: MonadIO m 
=> InterpolationMode

Level of interpolation engine strictness

-> SourceLocation

Location of the template (important for error reporting)

-> Text

Text of the template

-> SqlTemplateVariables

List of variables to use for a substitution process

-> m (Either InterpolationError Text) 

Substitutes variables in mustache template. Does not supports Haskell function interpolation.

initInterpreterForMustache :: forall {k} m (b :: k). (MonadIO m, InterpreterBackendSupport b) => Proxy b -> LogEnv -> m InterpreterInstance #

Creates an instance of the Haskell interpreter to use for Mustache templating purposes.