Skip to content

Commit ee5c8b9

Browse files
committed
fix: function doc improvements
1 parent e2c9923 commit ee5c8b9

File tree

2 files changed

+17
-8
lines changed

2 files changed

+17
-8
lines changed

docs/README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,8 @@ SELECT tp_bar(85,
7777
│ 🟨🟨🟨🟨🟨🟨🟨🟨🟨⬜ │
7878
└──────────────────────┘
7979

80-
-- Custom characters
81-
SELECT tp_bar(0.7, on := '', off := '', width := 15) as bar;
80+
-- Custom characters (note: "on" and "off" are reserved keywords, so they must be quoted)
81+
SELECT tp_bar(0.7, "on" := '', "off" := '', width := 15) as bar;
8282
┌─────────────────┐
8383
│ bar │
8484
varchar
@@ -158,7 +158,7 @@ FROM (select random() as n from generate_series(10));
158158
- `width`: Bar width in characters (default: 10)
159159
- `shape`: 'square', 'circle', or 'heart' (default: 'square')
160160
- `on_color`/`off_color`: Color names (red, green, blue, yellow, etc.)
161-
- `on`/`off`: Custom characters for filled/empty portions
161+
- `"on"`/`"off"`: Custom characters for filled/empty portions (must be quoted - reserved keywords)
162162
- `filled`: Boolean, fill all blocks or just the endpoint (default: true)
163163
- `thresholds`: List of threshold objects for conditional coloring
164164

@@ -400,8 +400,8 @@ select tp_qr('hello world', ecc := 'high');
400400

401401
**Advanced Options:**
402402
```sql
403-
-- Custom colors and shapes
404-
SELECT tp_qr('https://query.farm', ecc := 'high', "on" := '🟡', off := '');
403+
-- Custom colors and shapes (note: "on" and "off" are reserved keywords, so they must be quoted)
404+
SELECT tp_qr('https://query.farm', ecc := 'high', "on" := '🟡', "off" := '');
405405
🟡🟡🟡🟡🟡🟡🟡⚫🟡⚫🟡⚫🟡⚫🟡⚫⚫⚫🟡⚫🟡⚫🟡🟡🟡🟡🟡🟡🟡
406406
🟡⚫⚫⚫⚫⚫🟡⚫🟡⚫⚫⚫🟡⚫🟡⚫🟡⚫⚫🟡⚫⚫🟡⚫⚫⚫⚫⚫🟡
407407
🟡⚫🟡🟡🟡⚫🟡⚫🟡🟡🟡🟡🟡🟡⚫🟡🟡⚫⚫🟡🟡⚫🟡⚫🟡🟡🟡⚫🟡
@@ -437,8 +437,8 @@ SELECT tp_qr('https://query.farm', ecc := 'high', "on" := '🟡', off := '⚫');
437437
**Parameters:**
438438
- `value`: String value to encode in the QR code.
439439
- `ecc`: Error correction level ('low', 'medium', 'quartile', 'high', default: 'low')
440-
- `on`: Character for filled modules (default: '⬛')
441-
- `off`: Character for empty modules (default: '⬜')
440+
- `"on"`: Character for filled modules (default: '⬛') - must be quoted (reserved keyword)
441+
- `"off"`: Character for empty modules (default: '⬜') - must be quoted (reserved keyword)
442442

443443

444444
## Tips and Best Practices

src/textplot_sparkline.cpp

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,16 @@ unique_ptr<FunctionData> TextplotSparklineBind(ClientContext &context, ScalarFun
347347

348348
auto available_themes = EnhancedSparklineThemes::getAvailableThemes(mode);
349349
if (theme.empty()) {
350-
theme = available_themes.front();
350+
// Set default theme based on mode (matching documentation)
351+
switch (mode) {
352+
case SparklineMode::ABSOLUTE:
353+
theme = "utf8_blocks";
354+
break;
355+
case SparklineMode::DELTA:
356+
case SparklineMode::TREND:
357+
theme = "arrows";
358+
break;
359+
}
351360
}
352361
if (std::find(available_themes.begin(), available_themes.end(), theme) == available_themes.end()) {
353362
throw BinderException(StringUtil::Format("tp_sparkline: Unknown theme '%s' for type '%s' available are <%s>",

0 commit comments

Comments
 (0)