pgModeler supports code snippets which are text fragments mainly used to avoid repetitive code typing when managing databases via SQL tool on Manage view. Snippets can be written in the form of pure SQL commands or using a special set of commands known as schema micro language (detailed in Appendix I: Schema micro language) a simple programming language used internally by pgModeler to generate code. To provide the users a way to store their own code snippets, pgModeler implemented a snippet configuration widget (see below). The widget groups snippets by object type and also provides a basic code validation when writing snippets in the schema micro language.
Option/Action/Attribute | Description |
---|---|
Snippets |
This combo box lists all snippets available. The command buttons beside it are respectively used to create a new snippet, edit the current snippet, delete the current snippet, and destroy all snippets. |
Filter |
This combo box filters the list of snippets by category. |
ID |
The unique identifier for the currently handled snippet. This ID will be listed in the code completion widget and will be used to insert the code held by the snippet in any source code field. |
Applies to |
Category or object type that the snippet is part of. |
Label |
A brief description of what the snippet means. |
Parsable |
Indicates that the snippet is written in the schema micro language syntax and demands a parsing process. When using a parsable snippet the attributes surrounded in {} will be replaced by the selected object's matching attributes in the database explorer on Manage view. |
Placeholders |
When handling parsable snippets empty attributes will be replaced by a value in the format {attribute} . Note that this option can affect the semantics of the resulting snippet. |
Parse button |
Runs the validation process for the current snippet. |
Add or update button |
Registers the new snippet or update the contents of the current one. |