Wrapper class for raw text entered intoDocumentation Index
Fetch the complete documentation index at: https://docs.pysquirrels.com/llms.txt
Use this file to discover all available pages before exploring further.
TextParameter widgets. It is returned by methods such as TextParameter.get_entered_text() so that the text cannot be accidentally treated as a plain string (for example, when building SQL).
Instead of converting a TextValue directly to a string, you transform it using helper methods or pass it to APIs such as ContextArgs.set_placeholder, which safely unwrap the underlying text.
Instances of TextValue are created by Squirrels and returned from parameter methods; you should not instantiate this class directly in your project code.
If TextValue is needed for type annotation, it can be imported from the squirrels.types or squirrels module.
Methods
apply()
Transforms the entered text using a function that takes a string and returns a string, and returns a newTextValue.
A new
TextValue with the transformed text.apply_percent_wrap()
Returns a newTextValue with percent signs added before and after the entered text (for example, for use in SQL LIKE patterns).
A new
TextValue with percent signs wrapping the text.apply_as_bool()
Transforms the entered text with a function that takes a string and returns a boolean.The boolean result from the input function.
apply_as_number()
Transforms the entered text with a function that takes a string and returns a number.The numeric result from the input function.
apply_as_datetime()
Transforms the entered text with a function that takes a string and returns adatetime object.
The datetime result from the input function.
datetime, a configuration error is raised.
Examples
TheTextValue class is primarily used as a type hint in pyconfigs/context.py. You receive TextValue instances from methods like TextParameter.get_entered_text(), then transform them using the provided methods before passing to APIs that safely handle the text.