Search templates
When you construct a template for a structural search you are basically writing a script. To simplify your scripting process, DataGrip offers you a list of predefined search templates that you can use as prototypes for your search template.
On how to access the list of the existing search and replace templates, see the structural search and replace section.
Each search or replace template consists of variables $variable_name$
to which you can add a condition (modifier) to narrow your search results. Modifiers depend on a variable in your search template.
Count modifier
The Count modifier specifies a number of occurrences.
If you do not set the Count modifier explicitly, the IDE looks for only one template match. In other words, when the Count modifier is not applied, the default values for the modifier are min = 1
and max = 1
.
DataGrip adds [0,∞]
to the variable and searches for the specified range of numbers.
Reference modifier
The Reference modifier lets you reference some other search template in the variable.
The reference will always contain the name of a preconfigured or saved template, and you can use auto-completion to fill out this field.
Type modifier
The Type modifier adds a type of the value or expression that is expected for the specified variable.
To find the type category, use the name of the category in square brackets (for example, [string]
or [integer]
).
To find a specific type, use the name of the type as a modifier value (for example, text
, varchar(50)
, int
). Also, you can use regular expression in filter values (for example, varchar\(.*\)
). To enable regular expression, select the Regex checkbox in modifier settings.
UNKNOWN
is used for expressions the type of which cannot be identified.INTEGER
is a numeric data type for a range from -2147483648 to 2147483647 (for example,column_1 int
).REAL
is a numeric data type for floating precision number data from -3.40E + 38 to 3.40E + 38 (for example,column_1 real
).STRING
is a string data type that includes all corresponding types like CHAR, VARCHAR, TEXT and others (for example,column_1 real
)BOOLEAN
is a boolean type that can betrue
orfalse
.DATE_TIME
is a combination of a date and time. Format:YYYY-MM-DD hh:mm:ss
.DATE
is a type for dates. Format: YYYY-MM-DD.TIME
is a type for time. Format: hh:mm:ss.TIMESTAMP
is a date and time type that is stored as the number of seconds since the Unix epoch ('1970-01-01 00:00:00' UTC). Format: YYYY-MM-DD hh:mm:ss.INTERVAL
is a type that stores the quantity of time between two datetime values (for example,now() - INTERVAL '1 year 3 hours 20 minutes'
).BYTES
is a data type that allows whole numbers from 0 to 255.ARRAY
is a composite data type that consists of zero or more elements of a specified data type (for example,column_1 ARRAY[int]
).COLLECTION
is an ordered group of elements, all of the same type.TABLE
is a data type that stores a result set for later processing.RECORD
is a data type that allows to create a new data type with the desired column structure.SETOF
is a return type to return a result set.
Text filter
The Text modifier checks the variable against regular expressions or plain text.
For example, the var\d
value for the text
modifier in the expression
context will find all the variables that start with var
and have one digit afterwards.
Script constraints
The Script modifier adds Groovy script constraints to the search template. Script constraints are used when you search for certain language constructs.
All variables used in a template can be accessed from script constraints. When you add a script constraint to your variable, DataGrip matches it against the PSI tree, this variable is in fact a node in the PSI tree.