context
FormatArgs(prefix)
Data structure for recording values in jinja blocks to be formatted by psycopg
Parameters:
-
prefix
(
str
) –Prefix used in dictionary keys
Source code in jinja_psycopg/context.py
FormatArgsContext(name)
Wrapper for contextvars.ContextVar used for saving format args from within
psycopg
filter and for creating argument recorders
Parameters:
-
name
(
str
) –name used by the ContextVar
Source code in jinja_psycopg/context.py
save_value(value)
Parameters:
-
value
(
Any
) –value to save
Returns:
-
str
–generated key in the format of
prefix#number
Raises:
-
RuntimeError
–if ContextVar was empty
Source code in jinja_psycopg/context.py
recorder(prefix)
Parameters:
-
prefix
(
str
) –Prefix for the keys in the resulting dictionary
Returns:
-
FormatArgsRecorder
–new recorder with the given prefix
FormatArgsRecorder(context_var, prefix)
contextvars.ContextVar wrapper that works as a context manager and records arguments saved within its scope into a dictionary
Parameters:
-
context_var
(
ContextVar[Optional[FormatArgs]]
) –Inner ContextVar
-
prefix
(
str
) –Prefix used in dictionary keys