mirror of
https://github.com/h-sphere/sql-seal.git
synced 2026-07-22 10:10:28 +00:00
25 lines
No EOL
1.1 KiB
Markdown
25 lines
No EOL
1.1 KiB
Markdown
# Using properties
|
|
You can use properties to customise your queries and make them dynamic. This can be helpful if you plan to reuse your queries accross multiple files or use them in the templates.
|
|
|
|
You can refer to your properties by prepending them with an `@` symbol, for example `@year` to refer to `year` property.
|
|
|
|
## Built-in variables
|
|
On top of properties current file exposes in the properties, you can also use the following properties that will automatically get exposed:
|
|
|
|
| Property | Description | Sample value |
|
|
| ---------- | ------------------------------------------- | ---------------- |
|
|
| @path | Full path of the file you're editing | `folder/file.md` |
|
|
| @fileName | Filename with extension | `file.md` |
|
|
| @extension | Extension of the file (without leading dot) | `md` |
|
|
|
|
|
|
### Example 1: Selecting just the current file from the files table
|
|
|
|
```sqlseal
|
|
SELECT * FROM files WHERE path = @path
|
|
```
|
|
|
|
### Example2: Select tags of the current file
|
|
```sqlseal
|
|
SELECT * FROM tags WHERE path = @path
|
|
``` |