🎨 Add SQL query template function querySQL https://github.com/siyuan-note/siyuan/issues/13455

This commit is contained in:
Daniel 2024-12-13 22:01:14 +08:00
parent 1dc297d856
commit 322949e8e1
No known key found for this signature in database
GPG key ID: 86211BA83DF03017
5 changed files with 1149 additions and 1012 deletions

View file

@ -6,7 +6,7 @@
"id": "20201204184532-3qm9l8n", "id": "20201204184532-3qm9l8n",
"title": "Template snippet", "title": "Template snippet",
"type": "doc", "type": "doc",
"updated": "20241212163918" "updated": "20241213215714"
}, },
"Children": [ "Children": [
{ {
@ -57,7 +57,7 @@
"HeadingLevel": 2, "HeadingLevel": 2,
"Properties": { "Properties": {
"id": "20210104091444-jy56z0p", "id": "20210104091444-jy56z0p",
"updated": "20241212163918" "updated": "20241213215714"
}, },
"Children": [ "Children": [
{ {
@ -215,7 +215,7 @@
"ListData": {}, "ListData": {},
"Properties": { "Properties": {
"id": "20210104091444-mwbvc9m", "id": "20210104091444-mwbvc9m",
"updated": "20241212163918" "updated": "20241213215714"
}, },
"Children": [ "Children": [
{ {
@ -429,7 +429,7 @@
"Type": "NodeParagraph", "Type": "NodeParagraph",
"Properties": { "Properties": {
"id": "20210131162138-7ufhbho", "id": "20210131162138-7ufhbho",
"updated": "20240403150956" "updated": "20241213215545"
}, },
"Children": [ "Children": [
{ {
@ -443,7 +443,33 @@
}, },
{ {
"Type": "NodeText", "Type": "NodeText",
"Data": ": This function is used to query the database, and the return value is a list of blocks, please refer to the example below" "Data": ": This function is used to query the database, and the return value is a list of blocks"
}
]
},
{
"ID": "20241213215602-dk7iion",
"Type": "NodeCodeBlock",
"IsFencedCodeBlock": true,
"Properties": {
"id": "20241213215602-dk7iion",
"updated": "20241213215602"
},
"Children": [
{
"Type": "NodeCodeBlockFenceOpenMarker",
"Data": "```"
},
{
"Type": "NodeCodeBlockFenceInfoMarker"
},
{
"Type": "NodeCodeBlockCode",
"Data": ".action{$today := now | date \"20060102150405\"}\n.action{$blocks :=queryBlocks \"SELECT * FROM blocks WHERE content LIKE '?' AND updated \u003e '?' LIMIT ?\" \"%foo%\" $today \"3\"}\n"
},
{
"Type": "NodeCodeBlockFenceCloseMarker",
"Data": "```"
} }
] ]
} }
@ -466,7 +492,7 @@
"Type": "NodeParagraph", "Type": "NodeParagraph",
"Properties": { "Properties": {
"id": "20210504093232-6wxl589", "id": "20210504093232-6wxl589",
"updated": "20240403151002" "updated": "20241213215547"
}, },
"Children": [ "Children": [
{ {
@ -480,7 +506,96 @@
}, },
{ {
"Type": "NodeText", "Type": "NodeText",
"Data": ": This function is used to query the database, and the return value is a list of spans, please refer to the example below" "Data": ": This function is used to query the database, and the return value is a list of spans"
}
]
},
{
"ID": "20241213215606-a1mq6zf",
"Type": "NodeCodeBlock",
"IsFencedCodeBlock": true,
"Properties": {
"id": "20241213215606-a1mq6zf",
"updated": "20241213215606"
},
"Children": [
{
"Type": "NodeCodeBlockFenceOpenMarker",
"Data": "```"
},
{
"Type": "NodeCodeBlockFenceInfoMarker"
},
{
"Type": "NodeCodeBlockCode",
"Data": " .action{querySQL \"SELECT * FROM spans LIMIT ?\" \"3\"}\n"
},
{
"Type": "NodeCodeBlockFenceCloseMarker",
"Data": "```"
}
]
}
]
},
{
"ID": "20241213214939-he4wmcd",
"Type": "NodeListItem",
"ListData": {
"BulletChar": 42,
"Marker": "Kg=="
},
"Properties": {
"id": "20241213214939-he4wmcd",
"updated": "20241213214939"
},
"Children": [
{
"ID": "20241213214939-hrshqgv",
"Type": "NodeParagraph",
"Properties": {
"id": "20241213214939-hrshqgv",
"updated": "20241213215550"
},
"Children": [
{
"Type": "NodeText",
"Data": ""
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "querySQL"
},
{
"Type": "NodeText",
"Data": ": This function is used to query the database and the return value is a result set"
}
]
},
{
"ID": "20241213215554-rox3jk7",
"Type": "NodeCodeBlock",
"IsFencedCodeBlock": true,
"Properties": {
"id": "20241213215554-rox3jk7",
"updated": "20241213215554"
},
"Children": [
{
"Type": "NodeCodeBlockFenceOpenMarker",
"Data": "```"
},
{
"Type": "NodeCodeBlockFenceInfoMarker"
},
{
"Type": "NodeCodeBlockCode",
"Data": " .action{querySQL \"SELECT * FROM refs LIMIT 3\"}\n"
},
{
"Type": "NodeCodeBlockFenceCloseMarker",
"Data": "```"
} }
] ]
} }
@ -495,7 +610,7 @@
}, },
"Properties": { "Properties": {
"id": "20241212102027-j293sei", "id": "20241212102027-j293sei",
"updated": "20241212163902" "updated": "20241213215714"
}, },
"Children": [ "Children": [
{ {
@ -522,225 +637,203 @@
] ]
}, },
{ {
"ID": "20241212102028-60g8ajq", "ID": "20241213215714-u0j3i4k",
"Type": "NodeCodeBlock",
"IsFencedCodeBlock": true,
"Properties": {
"id": "20241213215714-u0j3i4k",
"updated": "20241213215714"
},
"Children": [
{
"Type": "NodeCodeBlockFenceOpenMarker",
"Data": "```"
},
{
"Type": "NodeCodeBlockFenceInfoMarker"
},
{
"Type": "NodeCodeBlockCode",
"Data": ".action{ (statBlock .id).RuneCount} .action{ (statBlock .id).WordCount}\n"
},
{
"Type": "NodeCodeBlockFenceCloseMarker",
"Data": "```"
}
]
},
{
"ID": "20241212102028-4ew89te",
"Type": "NodeList", "Type": "NodeList",
"ListData": {}, "ListData": {},
"Properties": { "Properties": {
"id": "20241212102028-60g8ajq", "id": "20241212102028-4ew89te",
"updated": "20241212102028" "updated": "20241212102028"
}, },
"Children": [ "Children": [
{ {
"ID": "20241212102028-eiulm47", "ID": "20241212102028-wai3afs",
"Type": "NodeListItem", "Type": "NodeListItem",
"ListData": { "ListData": {
"BulletChar": 42, "BulletChar": 42,
"Marker": "Kg==" "Marker": "Kg=="
}, },
"Properties": { "Properties": {
"id": "20241212102028-eiulm47", "id": "20241212102028-wai3afs",
"updated": "20241212102028" "updated": "20241212102028"
}, },
"Children": [ "Children": [
{ {
"ID": "20241212102028-ac9h87f", "ID": "20241212102028-wmtwngj",
"Type": "NodeParagraph", "Type": "NodeParagraph",
"Properties": { "Properties": {
"id": "20241212102028-ac9h87f", "id": "20241212102028-wmtwngj",
"updated": "20241212102028" "updated": "20241212102028"
}, },
"Children": [ "Children": [
{ {
"Type": "NodeText", "Type": "NodeText",
"Data": "" "Data": "RuneCount"
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": ".action{ (statBlock .id).RuneCount} .action{ (statBlock .id).WordCount}"
},
{
"Type": "NodeText",
"Data": ""
} }
] ]
}, }
]
},
{
"ID": "20241212102028-r9k7ody",
"Type": "NodeListItem",
"ListData": {
"BulletChar": 42,
"Marker": "Kg=="
},
"Properties": {
"id": "20241212102028-r9k7ody",
"updated": "20241212102028"
},
"Children": [
{ {
"ID": "20241212102028-4ew89te", "ID": "20241212102028-le5lpgo",
"Type": "NodeList", "Type": "NodeParagraph",
"ListData": {},
"Properties": { "Properties": {
"id": "20241212102028-4ew89te", "id": "20241212102028-le5lpgo",
"updated": "20241212102028" "updated": "20241212102028"
}, },
"Children": [ "Children": [
{ {
"ID": "20241212102028-wai3afs", "Type": "NodeText",
"Type": "NodeListItem", "Data": "WordCount"
"ListData": { }
"BulletChar": 42, ]
"Marker": "Kg==" }
}, ]
"Properties": { },
"id": "20241212102028-wai3afs", {
"updated": "20241212102028" "ID": "20241212102028-3egh1dg",
}, "Type": "NodeListItem",
"Children": [ "ListData": {
{ "BulletChar": 42,
"ID": "20241212102028-wmtwngj", "Marker": "Kg=="
"Type": "NodeParagraph", },
"Properties": { "Properties": {
"id": "20241212102028-wmtwngj", "id": "20241212102028-3egh1dg",
"updated": "20241212102028" "updated": "20241212102028"
}, },
"Children": [ "Children": [
{ {
"Type": "NodeText", "ID": "20241212102028-pijmoea",
"Data": "RuneCount" "Type": "NodeParagraph",
} "Properties": {
] "id": "20241212102028-pijmoea",
} "updated": "20241212102028"
] },
}, "Children": [
{ {
"ID": "20241212102028-r9k7ody", "Type": "NodeText",
"Type": "NodeListItem", "Data": "LinkCount"
"ListData": { }
"BulletChar": 42, ]
"Marker": "Kg==" }
}, ]
"Properties": { },
"id": "20241212102028-r9k7ody", {
"updated": "20241212102028" "ID": "20241212102028-qu6f5tc",
}, "Type": "NodeListItem",
"Children": [ "ListData": {
{ "BulletChar": 42,
"ID": "20241212102028-le5lpgo", "Marker": "Kg=="
"Type": "NodeParagraph", },
"Properties": { "Properties": {
"id": "20241212102028-le5lpgo", "id": "20241212102028-qu6f5tc",
"updated": "20241212102028" "updated": "20241212102028"
}, },
"Children": [ "Children": [
{ {
"Type": "NodeText", "ID": "20241212102028-8yj65um",
"Data": "WordCount" "Type": "NodeParagraph",
} "Properties": {
] "id": "20241212102028-8yj65um",
} "updated": "20241212102028"
] },
}, "Children": [
{ {
"ID": "20241212102028-3egh1dg", "Type": "NodeText",
"Type": "NodeListItem", "Data": "ImageCount"
"ListData": { }
"BulletChar": 42, ]
"Marker": "Kg==" }
}, ]
"Properties": { },
"id": "20241212102028-3egh1dg", {
"updated": "20241212102028" "ID": "20241212102028-8ivthzb",
}, "Type": "NodeListItem",
"Children": [ "ListData": {
{ "BulletChar": 42,
"ID": "20241212102028-pijmoea", "Marker": "Kg=="
"Type": "NodeParagraph", },
"Properties": { "Properties": {
"id": "20241212102028-pijmoea", "id": "20241212102028-8ivthzb",
"updated": "20241212102028" "updated": "20241212102028"
}, },
"Children": [ "Children": [
{ {
"Type": "NodeText", "ID": "20241212102028-p8nmm3a",
"Data": "LinkCount" "Type": "NodeParagraph",
} "Properties": {
] "id": "20241212102028-p8nmm3a",
} "updated": "20241212102028"
] },
}, "Children": [
{ {
"ID": "20241212102028-qu6f5tc", "Type": "NodeText",
"Type": "NodeListItem", "Data": "RefCount"
"ListData": { }
"BulletChar": 42, ]
"Marker": "Kg==" }
}, ]
"Properties": { },
"id": "20241212102028-qu6f5tc", {
"updated": "20241212102028" "ID": "20241212102028-frusted",
}, "Type": "NodeListItem",
"Children": [ "ListData": {
{ "BulletChar": 42,
"ID": "20241212102028-8yj65um", "Marker": "Kg=="
"Type": "NodeParagraph", },
"Properties": { "Properties": {
"id": "20241212102028-8yj65um", "id": "20241212102028-frusted",
"updated": "20241212102028" "updated": "20241212102028"
}, },
"Children": [ "Children": [
{ {
"Type": "NodeText", "ID": "20241212102028-h58utua",
"Data": "ImageCount" "Type": "NodeParagraph",
} "Properties": {
] "id": "20241212102028-h58utua",
} "updated": "20241212102028"
] },
}, "Children": [
{ {
"ID": "20241212102028-8ivthzb", "Type": "NodeText",
"Type": "NodeListItem", "Data": "BlockCount"
"ListData": {
"BulletChar": 42,
"Marker": "Kg=="
},
"Properties": {
"id": "20241212102028-8ivthzb",
"updated": "20241212102028"
},
"Children": [
{
"ID": "20241212102028-p8nmm3a",
"Type": "NodeParagraph",
"Properties": {
"id": "20241212102028-p8nmm3a",
"updated": "20241212102028"
},
"Children": [
{
"Type": "NodeText",
"Data": "RefCount"
}
]
}
]
},
{
"ID": "20241212102028-frusted",
"Type": "NodeListItem",
"ListData": {
"BulletChar": 42,
"Marker": "Kg=="
},
"Properties": {
"id": "20241212102028-frusted",
"updated": "20241212102028"
},
"Children": [
{
"ID": "20241212102028-h58utua",
"Type": "NodeParagraph",
"Properties": {
"id": "20241212102028-h58utua",
"updated": "20241212102028"
},
"Children": [
{
"Type": "NodeText",
"Data": "BlockCount"
}
]
}
]
} }
] ]
} }
@ -1158,64 +1251,6 @@
} }
] ]
}, },
{
"ID": "20210604111714-yc1e5gj",
"Type": "NodeParagraph",
"Properties": {
"id": "20210604111714-yc1e5gj",
"updated": "20210604111715"
},
"Children": [
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "queryBlocks"
},
{
"Type": "NodeText",
"Data": " and "
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "querySpans"
},
{
"Type": "NodeText",
"Data": " support variable parameter lists similar to SQL prepared statements to facilitate the input of parameters:"
}
]
},
{
"ID": "20210604111750-c3sm3jr",
"Type": "NodeCodeBlock",
"IsFencedCodeBlock": true,
"Properties": {
"id": "20210604111750-c3sm3jr",
"updated": "20210604111632"
},
"Children": [
{
"Type": "NodeCodeBlockFenceOpenMarker",
"Data": "```"
},
{
"Type": "NodeCodeBlockFenceInfoMarker"
},
{
"ID": "20220307092214-3yza25q",
"Type": "NodeCodeBlockCode",
"Data": ".action{$today := now | date \"20060102150405\"}\n.action{$blocks :=queryBlocks \"SELECT * FROM blocks WHERE content LIKE '?' AND updated \u003e '?' LIMIT ?\" \"%foo%\" $today \"3\"}\n",
"Properties": {
"id": "20220307092214-3yza25q"
}
},
{
"Type": "NodeCodeBlockFenceCloseMarker",
"Data": "```"
}
]
},
{ {
"ID": "20210104091444-4re70bp", "ID": "20210104091444-4re70bp",
"Type": "NodeHeading", "Type": "NodeHeading",

View file

@ -6,7 +6,7 @@
"id": "20201204181006-7bkppue", "id": "20201204181006-7bkppue",
"title": "模板片段", "title": "模板片段",
"type": "doc", "type": "doc",
"updated": "20241212163739" "updated": "20241213215655"
}, },
"Children": [ "Children": [
{ {
@ -69,7 +69,7 @@
"HeadingLevel": 2, "HeadingLevel": 2,
"Properties": { "Properties": {
"id": "20210104091309-fhb549c", "id": "20210104091309-fhb549c",
"updated": "20241212163739" "updated": "20241213215655"
}, },
"Children": [ "Children": [
{ {
@ -237,7 +237,7 @@
"ListData": {}, "ListData": {},
"Properties": { "Properties": {
"id": "20210104091309-gjkg3u5", "id": "20210104091309-gjkg3u5",
"updated": "20241212163739" "updated": "20241213215655"
}, },
"Children": [ "Children": [
{ {
@ -451,7 +451,7 @@
"Type": "NodeParagraph", "Type": "NodeParagraph",
"Properties": { "Properties": {
"id": "20210131155558-ghlchbx", "id": "20210131155558-ghlchbx",
"updated": "20240403150712" "updated": "20241213215236"
}, },
"Children": [ "Children": [
{ {
@ -465,7 +465,33 @@
}, },
{ {
"Type": "NodeText", "Type": "NodeText",
"Data": "​:该函数用于查询数据库,返回值为 blocks 列表,请参考下面的例子" "Data": "​:该函数用于查询数据库,返回值为 blocks 列表"
}
]
},
{
"ID": "20210604111446-p6vadfc",
"Type": "NodeCodeBlock",
"IsFencedCodeBlock": true,
"Properties": {
"id": "20210604111446-p6vadfc",
"updated": "20241213215118"
},
"Children": [
{
"Type": "NodeCodeBlockFenceOpenMarker",
"Data": "```"
},
{
"Type": "NodeCodeBlockFenceInfoMarker"
},
{
"Type": "NodeCodeBlockCode",
"Data": ".action{$today := now | date \"20060102150405\"}\n.action{$blocks :=queryBlocks \"SELECT * FROM blocks WHERE content LIKE '?' AND updated \u003e '?' LIMIT ?\" \"%foo%\" $today \"3\"}\n"
},
{
"Type": "NodeCodeBlockFenceCloseMarker",
"Data": "```"
} }
] ]
} }
@ -480,7 +506,7 @@
}, },
"Properties": { "Properties": {
"id": "20210504093313-4aoyxd0", "id": "20210504093313-4aoyxd0",
"updated": "20240403150838" "updated": "20241213215416"
}, },
"Children": [ "Children": [
{ {
@ -488,7 +514,7 @@
"Type": "NodeParagraph", "Type": "NodeParagraph",
"Properties": { "Properties": {
"id": "20210504093313-ya53o58", "id": "20210504093313-ya53o58",
"updated": "20240403150838" "updated": "20241213215302"
}, },
"Children": [ "Children": [
{ {
@ -502,7 +528,96 @@
}, },
{ {
"Type": "NodeText", "Type": "NodeText",
"Data": "​:该函数用于查询数据库,返回值为 spans 列表,请参考下面的例子" "Data": "​:该函数用于查询数据库,返回值为 spans 列表"
}
]
},
{
"ID": "20241213215337-rhkoc8k",
"Type": "NodeCodeBlock",
"IsFencedCodeBlock": true,
"Properties": {
"id": "20241213215337-rhkoc8k",
"updated": "20241213215416"
},
"Children": [
{
"Type": "NodeCodeBlockFenceOpenMarker",
"Data": "```"
},
{
"Type": "NodeCodeBlockFenceInfoMarker"
},
{
"Type": "NodeCodeBlockCode",
"Data": " .action{querySQL \"SELECT * FROM spans LIMIT ?\" \"3\"}\n"
},
{
"Type": "NodeCodeBlockFenceCloseMarker",
"Data": "```"
}
]
}
]
},
{
"ID": "20241213214733-ro4xcjm",
"Type": "NodeListItem",
"ListData": {
"BulletChar": 42,
"Marker": "Kg=="
},
"Properties": {
"id": "20241213214733-ro4xcjm",
"updated": "20241213215421"
},
"Children": [
{
"ID": "20241213214733-73dpip9",
"Type": "NodeParagraph",
"Properties": {
"id": "20241213214733-73dpip9",
"updated": "20241213215139"
},
"Children": [
{
"Type": "NodeText",
"Data": ""
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "querySQL"
},
{
"Type": "NodeText",
"Data": "​:该函数用于查询数据库,返回值为结果集"
}
]
},
{
"ID": "20241213215240-f33bsqs",
"Type": "NodeCodeBlock",
"IsFencedCodeBlock": true,
"Properties": {
"id": "20241213215240-f33bsqs",
"updated": "20241213215421"
},
"Children": [
{
"Type": "NodeCodeBlockFenceOpenMarker",
"Data": "```"
},
{
"Type": "NodeCodeBlockFenceInfoMarker"
},
{
"Type": "NodeCodeBlockCode",
"Data": " .action{querySQL \"SELECT * FROM refs LIMIT 3\"}\n"
},
{
"Type": "NodeCodeBlockFenceCloseMarker",
"Data": "```"
} }
] ]
} }
@ -517,7 +632,7 @@
}, },
"Properties": { "Properties": {
"id": "20241212101708-0euo6is", "id": "20241212101708-0euo6is",
"updated": "20241212163723" "updated": "20241213215655"
}, },
"Children": [ "Children": [
{ {
@ -544,225 +659,203 @@
] ]
}, },
{ {
"ID": "20241212101812-xivegzi", "ID": "20241212101810-6ffociu",
"Type": "NodeCodeBlock",
"IsFencedCodeBlock": true,
"Properties": {
"id": "20241212101810-6ffociu",
"updated": "20241213215655"
},
"Children": [
{
"Type": "NodeCodeBlockFenceOpenMarker",
"Data": "```"
},
{
"Type": "NodeCodeBlockFenceInfoMarker"
},
{
"Type": "NodeCodeBlockCode",
"Data": ".action{ (statBlock .id).RuneCount} .action{ (statBlock .id).WordCount}\n"
},
{
"Type": "NodeCodeBlockFenceCloseMarker",
"Data": "```"
}
]
},
{
"ID": "20241212101821-kf6un09",
"Type": "NodeList", "Type": "NodeList",
"ListData": {}, "ListData": {},
"Properties": { "Properties": {
"id": "20241212101812-xivegzi", "id": "20241212101821-kf6un09",
"updated": "20241212101821" "updated": "20241212101821"
}, },
"Children": [ "Children": [
{ {
"ID": "20241212101810-d297xu2", "ID": "20241212101821-1qt2j1i",
"Type": "NodeListItem", "Type": "NodeListItem",
"ListData": { "ListData": {
"BulletChar": 42, "BulletChar": 42,
"Marker": "Kg==" "Marker": "Kg=="
}, },
"Properties": { "Properties": {
"id": "20241212101810-d297xu2", "id": "20241212101821-1qt2j1i",
"updated": "20241212101821" "updated": "20241212101821"
}, },
"Children": [ "Children": [
{ {
"ID": "20241212101810-6ffociu", "ID": "20241212101821-mkxql2a",
"Type": "NodeParagraph", "Type": "NodeParagraph",
"Properties": { "Properties": {
"id": "20241212101810-6ffociu", "id": "20241212101821-mkxql2a",
"updated": "20241212101812"
},
"Children": [
{
"Type": "NodeText",
"Data": ""
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": ".action{ (statBlock .id).RuneCount} .action{ (statBlock .id).WordCount}"
},
{
"Type": "NodeText",
"Data": ""
}
]
},
{
"ID": "20241212101821-kf6un09",
"Type": "NodeList",
"ListData": {},
"Properties": {
"id": "20241212101821-kf6un09",
"updated": "20241212101821" "updated": "20241212101821"
}, },
"Children": [ "Children": [
{ {
"ID": "20241212101821-1qt2j1i", "Type": "NodeText",
"Type": "NodeListItem", "Data": "RuneCount"
"ListData": { }
"BulletChar": 42, ]
"Marker": "Kg==" }
}, ]
"Properties": { },
"id": "20241212101821-1qt2j1i", {
"updated": "20241212101821" "ID": "20241212101821-kok8u5t",
}, "Type": "NodeListItem",
"Children": [ "ListData": {
{ "BulletChar": 42,
"ID": "20241212101821-mkxql2a", "Marker": "Kg=="
"Type": "NodeParagraph", },
"Properties": { "Properties": {
"id": "20241212101821-mkxql2a", "id": "20241212101821-kok8u5t",
"updated": "20241212101821" "updated": "20241212101821"
}, },
"Children": [ "Children": [
{ {
"Type": "NodeText", "ID": "20241212101821-7gsgfqo",
"Data": "RuneCount" "Type": "NodeParagraph",
} "Properties": {
] "id": "20241212101821-7gsgfqo",
} "updated": "20241212101821"
] },
}, "Children": [
{ {
"ID": "20241212101821-kok8u5t", "Type": "NodeText",
"Type": "NodeListItem", "Data": "WordCount"
"ListData": { }
"BulletChar": 42, ]
"Marker": "Kg==" }
}, ]
"Properties": { },
"id": "20241212101821-kok8u5t", {
"updated": "20241212101821" "ID": "20241212101821-jxbirdz",
}, "Type": "NodeListItem",
"Children": [ "ListData": {
{ "BulletChar": 42,
"ID": "20241212101821-7gsgfqo", "Marker": "Kg=="
"Type": "NodeParagraph", },
"Properties": { "Properties": {
"id": "20241212101821-7gsgfqo", "id": "20241212101821-jxbirdz",
"updated": "20241212101821" "updated": "20241212101821"
}, },
"Children": [ "Children": [
{ {
"Type": "NodeText", "ID": "20241212101821-mep8mwc",
"Data": "WordCount" "Type": "NodeParagraph",
} "Properties": {
] "id": "20241212101821-mep8mwc",
} "updated": "20241212101821"
] },
}, "Children": [
{ {
"ID": "20241212101821-jxbirdz", "Type": "NodeText",
"Type": "NodeListItem", "Data": "LinkCount"
"ListData": { }
"BulletChar": 42, ]
"Marker": "Kg==" }
}, ]
"Properties": { },
"id": "20241212101821-jxbirdz", {
"updated": "20241212101821" "ID": "20241212101821-8dho5yg",
}, "Type": "NodeListItem",
"Children": [ "ListData": {
{ "BulletChar": 42,
"ID": "20241212101821-mep8mwc", "Marker": "Kg=="
"Type": "NodeParagraph", },
"Properties": { "Properties": {
"id": "20241212101821-mep8mwc", "id": "20241212101821-8dho5yg",
"updated": "20241212101821" "updated": "20241212101821"
}, },
"Children": [ "Children": [
{ {
"Type": "NodeText", "ID": "20241212101821-hriiyll",
"Data": "LinkCount" "Type": "NodeParagraph",
} "Properties": {
] "id": "20241212101821-hriiyll",
} "updated": "20241212101821"
] },
}, "Children": [
{ {
"ID": "20241212101821-8dho5yg", "Type": "NodeText",
"Type": "NodeListItem", "Data": "ImageCount"
"ListData": { }
"BulletChar": 42, ]
"Marker": "Kg==" }
}, ]
"Properties": { },
"id": "20241212101821-8dho5yg", {
"updated": "20241212101821" "ID": "20241212101821-mrg92au",
}, "Type": "NodeListItem",
"Children": [ "ListData": {
{ "BulletChar": 42,
"ID": "20241212101821-hriiyll", "Marker": "Kg=="
"Type": "NodeParagraph", },
"Properties": { "Properties": {
"id": "20241212101821-hriiyll", "id": "20241212101821-mrg92au",
"updated": "20241212101821" "updated": "20241212101821"
}, },
"Children": [ "Children": [
{ {
"Type": "NodeText", "ID": "20241212101821-ovwsmzs",
"Data": "ImageCount" "Type": "NodeParagraph",
} "Properties": {
] "id": "20241212101821-ovwsmzs",
} "updated": "20241212101821"
] },
}, "Children": [
{ {
"ID": "20241212101821-mrg92au", "Type": "NodeText",
"Type": "NodeListItem", "Data": "RefCount"
"ListData": { }
"BulletChar": 42, ]
"Marker": "Kg==" }
}, ]
"Properties": { },
"id": "20241212101821-mrg92au", {
"updated": "20241212101821" "ID": "20241212101821-kq0fb53",
}, "Type": "NodeListItem",
"Children": [ "ListData": {
{ "BulletChar": 42,
"ID": "20241212101821-ovwsmzs", "Marker": "Kg=="
"Type": "NodeParagraph", },
"Properties": { "Properties": {
"id": "20241212101821-ovwsmzs", "id": "20241212101821-kq0fb53",
"updated": "20241212101821" "updated": "20241212101821"
}, },
"Children": [ "Children": [
{ {
"Type": "NodeText", "ID": "20241212101821-6k4evcn",
"Data": "RefCount" "Type": "NodeParagraph",
} "Properties": {
] "id": "20241212101821-6k4evcn",
} "updated": "20241212101821"
] },
}, "Children": [
{ {
"ID": "20241212101821-kq0fb53", "Type": "NodeText",
"Type": "NodeListItem", "Data": "BlockCount"
"ListData": {
"BulletChar": 42,
"Marker": "Kg=="
},
"Properties": {
"id": "20241212101821-kq0fb53",
"updated": "20241212101821"
},
"Children": [
{
"ID": "20241212101821-6k4evcn",
"Type": "NodeParagraph",
"Properties": {
"id": "20241212101821-6k4evcn",
"updated": "20241212101821"
},
"Children": [
{
"Type": "NodeText",
"Data": "BlockCount"
}
]
}
]
} }
] ]
} }
@ -1180,64 +1273,6 @@
} }
] ]
}, },
{
"ID": "20210604111213-774ll6c",
"Type": "NodeParagraph",
"Properties": {
"id": "20210604111213-774ll6c",
"updated": "20210604111557"
},
"Children": [
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "queryBlocks"
},
{
"Type": "NodeText",
"Data": " 和 "
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "querySpans"
},
{
"Type": "NodeText",
"Data": " 支持类似 SQL 预编译语句的变参列表,方便传入参数:"
}
]
},
{
"ID": "20210604111446-p6vadfc",
"Type": "NodeCodeBlock",
"IsFencedCodeBlock": true,
"Properties": {
"id": "20210604111446-p6vadfc",
"updated": "20210604111632"
},
"Children": [
{
"Type": "NodeCodeBlockFenceOpenMarker",
"Data": "```"
},
{
"Type": "NodeCodeBlockFenceInfoMarker"
},
{
"ID": "20220307091943-diuexe8",
"Type": "NodeCodeBlockCode",
"Data": ".action{$today := now | date \"20060102150405\"}\n.action{$blocks :=queryBlocks \"SELECT * FROM blocks WHERE content LIKE '?' AND updated \u003e '?' LIMIT ?\" \"%foo%\" $today \"3\"}\n",
"Properties": {
"id": "20220307091943-diuexe8"
}
},
{
"Type": "NodeCodeBlockFenceCloseMarker",
"Data": "```"
}
]
},
{ {
"ID": "20210104091309-h71ogwf", "ID": "20210104091309-h71ogwf",
"Type": "NodeHeading", "Type": "NodeHeading",

View file

@ -6,7 +6,7 @@
"id": "20211226123004-dplpw0o", "id": "20211226123004-dplpw0o",
"title": "範本片段", "title": "範本片段",
"type": "doc", "type": "doc",
"updated": "20241212164017" "updated": "20241213215707"
}, },
"Children": [ "Children": [
{ {
@ -53,7 +53,7 @@
"HeadingLevel": 2, "HeadingLevel": 2,
"Properties": { "Properties": {
"id": "20211226123024-eyagqur", "id": "20211226123024-eyagqur",
"updated": "20241212164017" "updated": "20241213215707"
}, },
"Children": [ "Children": [
{ {
@ -208,7 +208,7 @@
"ListData": {}, "ListData": {},
"Properties": { "Properties": {
"id": "20211226123024-pjvw31z", "id": "20211226123024-pjvw31z",
"updated": "20241212164017" "updated": "20241213215707"
}, },
"Children": [ "Children": [
{ {
@ -422,7 +422,7 @@
"Type": "NodeParagraph", "Type": "NodeParagraph",
"Properties": { "Properties": {
"id": "20211226123024-vxjdsno", "id": "20211226123024-vxjdsno",
"updated": "20240403150942" "updated": "20241213215430"
}, },
"Children": [ "Children": [
{ {
@ -436,7 +436,33 @@
}, },
{ {
"Type": "NodeText", "Type": "NodeText",
"Data": "​:該函數用於查詢資料庫,返回值為 blocks 列表,請參考下面的例子" "Data": "​:該函數用於查詢資料庫,返回值為 blocks 列表"
}
]
},
{
"ID": "20241213215519-mfgruqs",
"Type": "NodeCodeBlock",
"IsFencedCodeBlock": true,
"Properties": {
"id": "20241213215519-mfgruqs",
"updated": "20241213215519"
},
"Children": [
{
"Type": "NodeCodeBlockFenceOpenMarker",
"Data": "```"
},
{
"Type": "NodeCodeBlockFenceInfoMarker"
},
{
"Type": "NodeCodeBlockCode",
"Data": ".action{$today := now | date \"20060102150405\"}\n.action{$blocks :=queryBlocks \"SELECT * FROM blocks WHERE content LIKE '?' AND updated \u003e '?' LIMIT ?\" \"%foo%\" $today \"3\"}\n"
},
{
"Type": "NodeCodeBlockFenceCloseMarker",
"Data": "```"
} }
] ]
} }
@ -459,7 +485,7 @@
"Type": "NodeParagraph", "Type": "NodeParagraph",
"Properties": { "Properties": {
"id": "20211226123024-4qwyf3w", "id": "20211226123024-4qwyf3w",
"updated": "20240403150944" "updated": "20241213215431"
}, },
"Children": [ "Children": [
{ {
@ -473,7 +499,96 @@
}, },
{ {
"Type": "NodeText", "Type": "NodeText",
"Data": "​:該函數用於查詢資料庫,返回值為 spans 列表,請參考下面的例子" "Data": "​:該函數用於查詢資料庫,返回值為 spans 列表"
}
]
},
{
"ID": "20241213215524-9an3khb",
"Type": "NodeCodeBlock",
"IsFencedCodeBlock": true,
"Properties": {
"id": "20241213215524-9an3khb",
"updated": "20241213215524"
},
"Children": [
{
"Type": "NodeCodeBlockFenceOpenMarker",
"Data": "```"
},
{
"Type": "NodeCodeBlockFenceInfoMarker"
},
{
"Type": "NodeCodeBlockCode",
"Data": " .action{querySQL \"SELECT * FROM spans LIMIT ?\" \"3\"}\n"
},
{
"Type": "NodeCodeBlockFenceCloseMarker",
"Data": "```"
}
]
}
]
},
{
"ID": "20241213214930-4votv1n",
"Type": "NodeListItem",
"ListData": {
"BulletChar": 42,
"Marker": "Kg=="
},
"Properties": {
"id": "20241213214930-4votv1n",
"updated": "20241213214930"
},
"Children": [
{
"ID": "20241213214930-dogaks1",
"Type": "NodeParagraph",
"Properties": {
"id": "20241213214930-dogaks1",
"updated": "20241213215433"
},
"Children": [
{
"Type": "NodeText",
"Data": ""
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "querySQL"
},
{
"Type": "NodeText",
"Data": "​:函數用於查詢資料庫,傳回值為結果集"
}
]
},
{
"ID": "20241213215530-f2iwrjz",
"Type": "NodeCodeBlock",
"IsFencedCodeBlock": true,
"Properties": {
"id": "20241213215530-f2iwrjz",
"updated": "20241213215530"
},
"Children": [
{
"Type": "NodeCodeBlockFenceOpenMarker",
"Data": "```"
},
{
"Type": "NodeCodeBlockFenceInfoMarker"
},
{
"Type": "NodeCodeBlockCode",
"Data": " .action{querySQL \"SELECT * FROM refs LIMIT 3\"}\n"
},
{
"Type": "NodeCodeBlockFenceCloseMarker",
"Data": "```"
} }
] ]
} }
@ -488,7 +603,7 @@
}, },
"Properties": { "Properties": {
"id": "20241212102019-gassjqt", "id": "20241212102019-gassjqt",
"updated": "20241212102113" "updated": "20241213215707"
}, },
"Children": [ "Children": [
{ {
@ -515,225 +630,203 @@
] ]
}, },
{ {
"ID": "20241212102021-87matlt", "ID": "20241213215707-lxpmd6b",
"Type": "NodeCodeBlock",
"IsFencedCodeBlock": true,
"Properties": {
"id": "20241213215707-lxpmd6b",
"updated": "20241213215707"
},
"Children": [
{
"Type": "NodeCodeBlockFenceOpenMarker",
"Data": "```"
},
{
"Type": "NodeCodeBlockFenceInfoMarker"
},
{
"Type": "NodeCodeBlockCode",
"Data": ".action{ (statBlock .id).RuneCount} .action{ (statBlock .id).WordCount}\n"
},
{
"Type": "NodeCodeBlockFenceCloseMarker",
"Data": "```"
}
]
},
{
"ID": "20241212102021-vj2zyyl",
"Type": "NodeList", "Type": "NodeList",
"ListData": {}, "ListData": {},
"Properties": { "Properties": {
"id": "20241212102021-87matlt", "id": "20241212102021-vj2zyyl",
"updated": "20241212102021" "updated": "20241212102021"
}, },
"Children": [ "Children": [
{ {
"ID": "20241212102021-t2dln9h", "ID": "20241212102021-92gy6t3",
"Type": "NodeListItem", "Type": "NodeListItem",
"ListData": { "ListData": {
"BulletChar": 42, "BulletChar": 42,
"Marker": "Kg==" "Marker": "Kg=="
}, },
"Properties": { "Properties": {
"id": "20241212102021-t2dln9h", "id": "20241212102021-92gy6t3",
"updated": "20241212102021" "updated": "20241212102021"
}, },
"Children": [ "Children": [
{ {
"ID": "20241212102021-cfsaes6", "ID": "20241212102021-d3lo8xu",
"Type": "NodeParagraph", "Type": "NodeParagraph",
"Properties": { "Properties": {
"id": "20241212102021-cfsaes6", "id": "20241212102021-d3lo8xu",
"updated": "20241212102021" "updated": "20241212102021"
}, },
"Children": [ "Children": [
{ {
"Type": "NodeText", "Type": "NodeText",
"Data": "" "Data": "RuneCount"
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": ".action{ (statBlock .id).RuneCount} .action{ (statBlock .id).WordCount}"
},
{
"Type": "NodeText",
"Data": ""
} }
] ]
}, }
]
},
{
"ID": "20241212102021-n8ufevw",
"Type": "NodeListItem",
"ListData": {
"BulletChar": 42,
"Marker": "Kg=="
},
"Properties": {
"id": "20241212102021-n8ufevw",
"updated": "20241212102021"
},
"Children": [
{ {
"ID": "20241212102021-vj2zyyl", "ID": "20241212102021-omvwh9v",
"Type": "NodeList", "Type": "NodeParagraph",
"ListData": {},
"Properties": { "Properties": {
"id": "20241212102021-vj2zyyl", "id": "20241212102021-omvwh9v",
"updated": "20241212102021" "updated": "20241212102021"
}, },
"Children": [ "Children": [
{ {
"ID": "20241212102021-92gy6t3", "Type": "NodeText",
"Type": "NodeListItem", "Data": "WordCount"
"ListData": { }
"BulletChar": 42, ]
"Marker": "Kg==" }
}, ]
"Properties": { },
"id": "20241212102021-92gy6t3", {
"updated": "20241212102021" "ID": "20241212102021-s12eoe7",
}, "Type": "NodeListItem",
"Children": [ "ListData": {
{ "BulletChar": 42,
"ID": "20241212102021-d3lo8xu", "Marker": "Kg=="
"Type": "NodeParagraph", },
"Properties": { "Properties": {
"id": "20241212102021-d3lo8xu", "id": "20241212102021-s12eoe7",
"updated": "20241212102021" "updated": "20241212102021"
}, },
"Children": [ "Children": [
{ {
"Type": "NodeText", "ID": "20241212102021-518qvnd",
"Data": "RuneCount" "Type": "NodeParagraph",
} "Properties": {
] "id": "20241212102021-518qvnd",
} "updated": "20241212102021"
] },
}, "Children": [
{ {
"ID": "20241212102021-n8ufevw", "Type": "NodeText",
"Type": "NodeListItem", "Data": "LinkCount"
"ListData": { }
"BulletChar": 42, ]
"Marker": "Kg==" }
}, ]
"Properties": { },
"id": "20241212102021-n8ufevw", {
"updated": "20241212102021" "ID": "20241212102021-dolb6ct",
}, "Type": "NodeListItem",
"Children": [ "ListData": {
{ "BulletChar": 42,
"ID": "20241212102021-omvwh9v", "Marker": "Kg=="
"Type": "NodeParagraph", },
"Properties": { "Properties": {
"id": "20241212102021-omvwh9v", "id": "20241212102021-dolb6ct",
"updated": "20241212102021" "updated": "20241212102021"
}, },
"Children": [ "Children": [
{ {
"Type": "NodeText", "ID": "20241212102021-dx5rhed",
"Data": "WordCount" "Type": "NodeParagraph",
} "Properties": {
] "id": "20241212102021-dx5rhed",
} "updated": "20241212102021"
] },
}, "Children": [
{ {
"ID": "20241212102021-s12eoe7", "Type": "NodeText",
"Type": "NodeListItem", "Data": "ImageCount"
"ListData": { }
"BulletChar": 42, ]
"Marker": "Kg==" }
}, ]
"Properties": { },
"id": "20241212102021-s12eoe7", {
"updated": "20241212102021" "ID": "20241212102021-yt0q53w",
}, "Type": "NodeListItem",
"Children": [ "ListData": {
{ "BulletChar": 42,
"ID": "20241212102021-518qvnd", "Marker": "Kg=="
"Type": "NodeParagraph", },
"Properties": { "Properties": {
"id": "20241212102021-518qvnd", "id": "20241212102021-yt0q53w",
"updated": "20241212102021" "updated": "20241212102021"
}, },
"Children": [ "Children": [
{ {
"Type": "NodeText", "ID": "20241212102021-z97tnzw",
"Data": "LinkCount" "Type": "NodeParagraph",
} "Properties": {
] "id": "20241212102021-z97tnzw",
} "updated": "20241212102021"
] },
}, "Children": [
{ {
"ID": "20241212102021-dolb6ct", "Type": "NodeText",
"Type": "NodeListItem", "Data": "RefCount"
"ListData": { }
"BulletChar": 42, ]
"Marker": "Kg==" }
}, ]
"Properties": { },
"id": "20241212102021-dolb6ct", {
"updated": "20241212102021" "ID": "20241212102021-npgihna",
}, "Type": "NodeListItem",
"Children": [ "ListData": {
{ "BulletChar": 42,
"ID": "20241212102021-dx5rhed", "Marker": "Kg=="
"Type": "NodeParagraph", },
"Properties": { "Properties": {
"id": "20241212102021-dx5rhed", "id": "20241212102021-npgihna",
"updated": "20241212102021" "updated": "20241212102021"
}, },
"Children": [ "Children": [
{ {
"Type": "NodeText", "ID": "20241212102021-80qheu7",
"Data": "ImageCount" "Type": "NodeParagraph",
} "Properties": {
] "id": "20241212102021-80qheu7",
} "updated": "20241212102021"
] },
}, "Children": [
{ {
"ID": "20241212102021-yt0q53w", "Type": "NodeText",
"Type": "NodeListItem", "Data": "BlockCount"
"ListData": {
"BulletChar": 42,
"Marker": "Kg=="
},
"Properties": {
"id": "20241212102021-yt0q53w",
"updated": "20241212102021"
},
"Children": [
{
"ID": "20241212102021-z97tnzw",
"Type": "NodeParagraph",
"Properties": {
"id": "20241212102021-z97tnzw",
"updated": "20241212102021"
},
"Children": [
{
"Type": "NodeText",
"Data": "RefCount"
}
]
}
]
},
{
"ID": "20241212102021-npgihna",
"Type": "NodeListItem",
"ListData": {
"BulletChar": 42,
"Marker": "Kg=="
},
"Properties": {
"id": "20241212102021-npgihna",
"updated": "20241212102021"
},
"Children": [
{
"ID": "20241212102021-80qheu7",
"Type": "NodeParagraph",
"Properties": {
"id": "20241212102021-80qheu7",
"updated": "20241212102021"
},
"Children": [
{
"Type": "NodeText",
"Data": "BlockCount"
}
]
}
]
} }
] ]
} }
@ -1151,64 +1244,6 @@
} }
] ]
}, },
{
"ID": "20211226123024-5rk6w30",
"Type": "NodeParagraph",
"Properties": {
"id": "20211226123024-5rk6w30",
"updated": "20211228134953"
},
"Children": [
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "queryBlocks"
},
{
"Type": "NodeText",
"Data": " 和 "
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "querySpans"
},
{
"Type": "NodeText",
"Data": " 支援類似 SQL 預編譯語句的變參列表,方便傳入參數:"
}
]
},
{
"ID": "20211226123024-sw1k190",
"Type": "NodeCodeBlock",
"IsFencedCodeBlock": true,
"Properties": {
"id": "20211226123024-sw1k190",
"updated": "20211225221841"
},
"Children": [
{
"Type": "NodeCodeBlockFenceOpenMarker",
"Data": "```"
},
{
"Type": "NodeCodeBlockFenceInfoMarker"
},
{
"ID": "20220307092237-mawslux",
"Type": "NodeCodeBlockCode",
"Data": ".action{$today := now | date \"20060102150405\"}\n.action{$blocks :=queryBlocks \"SELECT * FROM blocks WHERE content LIKE '?' AND updated \u003e '?' LIMIT ?\" \"%foo%\" $today \"3\"}\n",
"Properties": {
"id": "20220307092237-mawslux"
}
},
{
"Type": "NodeCodeBlockFenceCloseMarker",
"Data": "```"
}
]
},
{ {
"ID": "20211226123024-3wiifft", "ID": "20211226123024-3wiifft",
"Type": "NodeHeading", "Type": "NodeHeading",

View file

@ -7,7 +7,7 @@
"id": "20240530101000-6x9ivi7", "id": "20240530101000-6x9ivi7",
"title": "テンプレートスニペット", "title": "テンプレートスニペット",
"type": "doc", "type": "doc",
"updated": "20241212163955" "updated": "20241213215720"
}, },
"Children": [ "Children": [
{ {
@ -66,7 +66,7 @@
"Properties": { "Properties": {
"ID": "20240530101000-5nvn9ad", "ID": "20240530101000-5nvn9ad",
"id": "20240530101000-pi05yzt", "id": "20240530101000-pi05yzt",
"updated": "20241212163955" "updated": "20241213215720"
}, },
"Children": [ "Children": [
{ {
@ -226,7 +226,7 @@
"ListData": {}, "ListData": {},
"Properties": { "Properties": {
"id": "20240530101000-by5hqnb", "id": "20240530101000-by5hqnb",
"updated": "20241212163955" "updated": "20241213215720"
}, },
"Children": [ "Children": [
{ {
@ -440,7 +440,7 @@
"Type": "NodeParagraph", "Type": "NodeParagraph",
"Properties": { "Properties": {
"id": "20240530101000-obb5zo9", "id": "20240530101000-obb5zo9",
"updated": "20240530101000" "updated": "20241213215612"
}, },
"Children": [ "Children": [
{ {
@ -454,7 +454,33 @@
}, },
{ {
"Type": "NodeText", "Type": "NodeText",
"Data": ": この関数はデータベースをクエリしてブロックのリストを返します (下記の使用例を参照してください)" "Data": ": この関数はデータベースをクエリしてブロックのリストを返します"
}
]
},
{
"ID": "20241213215628-5gixpmp",
"Type": "NodeCodeBlock",
"IsFencedCodeBlock": true,
"Properties": {
"id": "20241213215628-5gixpmp",
"updated": "20241213215628"
},
"Children": [
{
"Type": "NodeCodeBlockFenceOpenMarker",
"Data": "```"
},
{
"Type": "NodeCodeBlockFenceInfoMarker"
},
{
"Type": "NodeCodeBlockCode",
"Data": ".action{$today := now | date \"20060102150405\"}\n.action{$blocks :=queryBlocks \"SELECT * FROM blocks WHERE content LIKE '?' AND updated \u003e '?' LIMIT ?\" \"%foo%\" $today \"3\"}\n"
},
{
"Type": "NodeCodeBlockFenceCloseMarker",
"Data": "```"
} }
] ]
} }
@ -477,7 +503,7 @@
"Type": "NodeParagraph", "Type": "NodeParagraph",
"Properties": { "Properties": {
"id": "20240530101000-4wi25sk", "id": "20240530101000-4wi25sk",
"updated": "20240530101000" "updated": "20241213215614"
}, },
"Children": [ "Children": [
{ {
@ -491,7 +517,96 @@
}, },
{ {
"Type": "NodeText", "Type": "NodeText",
"Data": ": この関数はデータベースをクエリしてスパンのリストを返します (下記の使用例を参照してください)" "Data": ": この関数はデータベースをクエリしてスパンのリストを返します"
}
]
},
{
"ID": "20241213215619-gkqs282",
"Type": "NodeCodeBlock",
"IsFencedCodeBlock": true,
"Properties": {
"id": "20241213215619-gkqs282",
"updated": "20241213215619"
},
"Children": [
{
"Type": "NodeCodeBlockFenceOpenMarker",
"Data": "```"
},
{
"Type": "NodeCodeBlockFenceInfoMarker"
},
{
"Type": "NodeCodeBlockCode",
"Data": " .action{querySQL \"SELECT * FROM spans LIMIT ?\" \"3\"}\n"
},
{
"Type": "NodeCodeBlockFenceCloseMarker",
"Data": "```"
}
]
}
]
},
{
"ID": "20241213215009-qrtc56j",
"Type": "NodeListItem",
"ListData": {
"BulletChar": 42,
"Marker": "Kg=="
},
"Properties": {
"id": "20241213215009-qrtc56j",
"updated": "20241213215009"
},
"Children": [
{
"ID": "20241213215009-fev1gao",
"Type": "NodeParagraph",
"Properties": {
"id": "20241213215009-fev1gao",
"updated": "20241213215617"
},
"Children": [
{
"Type": "NodeText",
"Data": ""
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "querySQL"
},
{
"Type": "NodeText",
"Data": ": この関数はデータベースへのクエリに使用され、戻り値は結果セットです"
}
]
},
{
"ID": "20241213215633-69ltmv1",
"Type": "NodeCodeBlock",
"IsFencedCodeBlock": true,
"Properties": {
"id": "20241213215633-69ltmv1",
"updated": "20241213215633"
},
"Children": [
{
"Type": "NodeCodeBlockFenceOpenMarker",
"Data": "```"
},
{
"Type": "NodeCodeBlockFenceInfoMarker"
},
{
"Type": "NodeCodeBlockCode",
"Data": " .action{querySQL \"SELECT * FROM refs LIMIT 3\"}\n"
},
{
"Type": "NodeCodeBlockFenceCloseMarker",
"Data": "```"
} }
] ]
} }
@ -506,7 +621,7 @@
}, },
"Properties": { "Properties": {
"id": "20241212102033-rn9u6t8", "id": "20241212102033-rn9u6t8",
"updated": "20241212102145" "updated": "20241213215720"
}, },
"Children": [ "Children": [
{ {
@ -533,225 +648,203 @@
] ]
}, },
{ {
"ID": "20241212102033-kyrog1c", "ID": "20241213215720-ueqpsna",
"Type": "NodeCodeBlock",
"IsFencedCodeBlock": true,
"Properties": {
"id": "20241213215720-ueqpsna",
"updated": "20241213215720"
},
"Children": [
{
"Type": "NodeCodeBlockFenceOpenMarker",
"Data": "```"
},
{
"Type": "NodeCodeBlockFenceInfoMarker"
},
{
"Type": "NodeCodeBlockCode",
"Data": ".action{ (statBlock .id).RuneCount} .action{ (statBlock .id).WordCount}\n"
},
{
"Type": "NodeCodeBlockFenceCloseMarker",
"Data": "```"
}
]
},
{
"ID": "20241212102033-ib8fdwx",
"Type": "NodeList", "Type": "NodeList",
"ListData": {}, "ListData": {},
"Properties": { "Properties": {
"id": "20241212102033-kyrog1c", "id": "20241212102033-ib8fdwx",
"updated": "20241212102033" "updated": "20241212102033"
}, },
"Children": [ "Children": [
{ {
"ID": "20241212102033-i3cnp1o", "ID": "20241212102033-lijk8pe",
"Type": "NodeListItem", "Type": "NodeListItem",
"ListData": { "ListData": {
"BulletChar": 42, "BulletChar": 42,
"Marker": "Kg==" "Marker": "Kg=="
}, },
"Properties": { "Properties": {
"id": "20241212102033-i3cnp1o", "id": "20241212102033-lijk8pe",
"updated": "20241212102033" "updated": "20241212102033"
}, },
"Children": [ "Children": [
{ {
"ID": "20241212102033-4vbgh1y", "ID": "20241212102033-ch66lvd",
"Type": "NodeParagraph", "Type": "NodeParagraph",
"Properties": { "Properties": {
"id": "20241212102033-4vbgh1y", "id": "20241212102033-ch66lvd",
"updated": "20241212102033" "updated": "20241212102033"
}, },
"Children": [ "Children": [
{ {
"Type": "NodeText", "Type": "NodeText",
"Data": "" "Data": "RuneCount"
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": ".action{ (statBlock .id).RuneCount} .action{ (statBlock .id).WordCount}"
},
{
"Type": "NodeText",
"Data": ""
} }
] ]
}, }
]
},
{
"ID": "20241212102033-527kxt0",
"Type": "NodeListItem",
"ListData": {
"BulletChar": 42,
"Marker": "Kg=="
},
"Properties": {
"id": "20241212102033-527kxt0",
"updated": "20241212102033"
},
"Children": [
{ {
"ID": "20241212102033-ib8fdwx", "ID": "20241212102033-7iop2es",
"Type": "NodeList", "Type": "NodeParagraph",
"ListData": {},
"Properties": { "Properties": {
"id": "20241212102033-ib8fdwx", "id": "20241212102033-7iop2es",
"updated": "20241212102033" "updated": "20241212102033"
}, },
"Children": [ "Children": [
{ {
"ID": "20241212102033-lijk8pe", "Type": "NodeText",
"Type": "NodeListItem", "Data": "WordCount"
"ListData": { }
"BulletChar": 42, ]
"Marker": "Kg==" }
}, ]
"Properties": { },
"id": "20241212102033-lijk8pe", {
"updated": "20241212102033" "ID": "20241212102033-zicftlk",
}, "Type": "NodeListItem",
"Children": [ "ListData": {
{ "BulletChar": 42,
"ID": "20241212102033-ch66lvd", "Marker": "Kg=="
"Type": "NodeParagraph", },
"Properties": { "Properties": {
"id": "20241212102033-ch66lvd", "id": "20241212102033-zicftlk",
"updated": "20241212102033" "updated": "20241212102033"
}, },
"Children": [ "Children": [
{ {
"Type": "NodeText", "ID": "20241212102033-871ju7g",
"Data": "RuneCount" "Type": "NodeParagraph",
} "Properties": {
] "id": "20241212102033-871ju7g",
} "updated": "20241212102033"
] },
}, "Children": [
{ {
"ID": "20241212102033-527kxt0", "Type": "NodeText",
"Type": "NodeListItem", "Data": "LinkCount"
"ListData": { }
"BulletChar": 42, ]
"Marker": "Kg==" }
}, ]
"Properties": { },
"id": "20241212102033-527kxt0", {
"updated": "20241212102033" "ID": "20241212102033-2k2gz3h",
}, "Type": "NodeListItem",
"Children": [ "ListData": {
{ "BulletChar": 42,
"ID": "20241212102033-7iop2es", "Marker": "Kg=="
"Type": "NodeParagraph", },
"Properties": { "Properties": {
"id": "20241212102033-7iop2es", "id": "20241212102033-2k2gz3h",
"updated": "20241212102033" "updated": "20241212102033"
}, },
"Children": [ "Children": [
{ {
"Type": "NodeText", "ID": "20241212102033-1ss2d9y",
"Data": "WordCount" "Type": "NodeParagraph",
} "Properties": {
] "id": "20241212102033-1ss2d9y",
} "updated": "20241212102033"
] },
}, "Children": [
{ {
"ID": "20241212102033-zicftlk", "Type": "NodeText",
"Type": "NodeListItem", "Data": "ImageCount"
"ListData": { }
"BulletChar": 42, ]
"Marker": "Kg==" }
}, ]
"Properties": { },
"id": "20241212102033-zicftlk", {
"updated": "20241212102033" "ID": "20241212102033-905g5ga",
}, "Type": "NodeListItem",
"Children": [ "ListData": {
{ "BulletChar": 42,
"ID": "20241212102033-871ju7g", "Marker": "Kg=="
"Type": "NodeParagraph", },
"Properties": { "Properties": {
"id": "20241212102033-871ju7g", "id": "20241212102033-905g5ga",
"updated": "20241212102033" "updated": "20241212102033"
}, },
"Children": [ "Children": [
{ {
"Type": "NodeText", "ID": "20241212102033-k7jgqz4",
"Data": "LinkCount" "Type": "NodeParagraph",
} "Properties": {
] "id": "20241212102033-k7jgqz4",
} "updated": "20241212102033"
] },
}, "Children": [
{ {
"ID": "20241212102033-2k2gz3h", "Type": "NodeText",
"Type": "NodeListItem", "Data": "RefCount"
"ListData": { }
"BulletChar": 42, ]
"Marker": "Kg==" }
}, ]
"Properties": { },
"id": "20241212102033-2k2gz3h", {
"updated": "20241212102033" "ID": "20241212102033-xbpy9ew",
}, "Type": "NodeListItem",
"Children": [ "ListData": {
{ "BulletChar": 42,
"ID": "20241212102033-1ss2d9y", "Marker": "Kg=="
"Type": "NodeParagraph", },
"Properties": { "Properties": {
"id": "20241212102033-1ss2d9y", "id": "20241212102033-xbpy9ew",
"updated": "20241212102033" "updated": "20241212102033"
}, },
"Children": [ "Children": [
{ {
"Type": "NodeText", "ID": "20241212102033-kvquhrn",
"Data": "ImageCount" "Type": "NodeParagraph",
} "Properties": {
] "id": "20241212102033-kvquhrn",
} "updated": "20241212102033"
] },
}, "Children": [
{ {
"ID": "20241212102033-905g5ga", "Type": "NodeText",
"Type": "NodeListItem", "Data": "BlockCount"
"ListData": {
"BulletChar": 42,
"Marker": "Kg=="
},
"Properties": {
"id": "20241212102033-905g5ga",
"updated": "20241212102033"
},
"Children": [
{
"ID": "20241212102033-k7jgqz4",
"Type": "NodeParagraph",
"Properties": {
"id": "20241212102033-k7jgqz4",
"updated": "20241212102033"
},
"Children": [
{
"Type": "NodeText",
"Data": "RefCount"
}
]
}
]
},
{
"ID": "20241212102033-xbpy9ew",
"Type": "NodeListItem",
"ListData": {
"BulletChar": 42,
"Marker": "Kg=="
},
"Properties": {
"id": "20241212102033-xbpy9ew",
"updated": "20241212102033"
},
"Children": [
{
"ID": "20241212102033-kvquhrn",
"Type": "NodeParagraph",
"Properties": {
"id": "20241212102033-kvquhrn",
"updated": "20241212102033"
},
"Children": [
{
"Type": "NodeText",
"Data": "BlockCount"
}
]
}
]
} }
] ]
} }
@ -1169,71 +1262,6 @@
} }
] ]
}, },
{
"ID": "20240530101000-5twj99z",
"Type": "NodeParagraph",
"Properties": {
"ID": "20240530101000-p45pa4c",
"id": "20240530101000-5twj99z",
"updated": "20240530101000"
},
"Children": [
{
"Type": "NodeText",
"Data": ""
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "queryBlocks"
},
{
"Type": "NodeText",
"Data": " と "
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "querySpans"
},
{
"Type": "NodeText",
"Data": " はパラメータの入力を容易にするために、SQL のプリペアドステートメントに似た可変長引数リストをサポートしています:"
}
]
},
{
"ID": "20240530101000-ao36z4x",
"Type": "NodeCodeBlock",
"IsFencedCodeBlock": true,
"Properties": {
"ID": "20240530101000-2pwl178",
"id": "20240530101000-ao36z4x",
"updated": "20240530101000"
},
"Children": [
{
"Type": "NodeCodeBlockFenceOpenMarker",
"Data": "```"
},
{
"Type": "NodeCodeBlockFenceInfoMarker"
},
{
"ID": "20240530101000-ry5jzum",
"Type": "NodeCodeBlockCode",
"Data": ".action{$today := now | date \"20060102150405\"}\n.action{$blocks :=queryBlocks \"SELECT * FROM blocks WHERE content LIKE '?' AND updated \u003e '?' LIMIT ?\" \"%foo%\" $today \"3\"}\n",
"Properties": {
"ID": "20240530101000-i3tqwi3",
"id": "20240530101000-ry5jzum"
}
},
{
"Type": "NodeCodeBlockFenceCloseMarker",
"Data": "```"
}
]
},
{ {
"ID": "20240530101000-ud82uol", "ID": "20240530101000-ud82uol",
"Type": "NodeHeading", "Type": "NodeHeading",

View file

@ -1513,4 +1513,8 @@ func SQLTemplateFuncs(templateFuncMap *template.FuncMap) {
retSpans = SelectSpansRawStmt(stmt, 512) retSpans = SelectSpansRawStmt(stmt, 512)
return return
} }
(*templateFuncMap)["querySQL"] = func(stmt string) (ret []map[string]interface{}) {
ret, _ = Query(stmt, 1024)
return
}
} }