mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-09-22 00:20:47 +02:00
🎨 Add template function getBlock
https://github.com/siyuan-note/siyuan/issues/14474
This commit is contained in:
parent
566c90cbba
commit
536aa39f95
5 changed files with 301 additions and 150 deletions
|
@ -6,7 +6,7 @@
|
|||
"id": "20201204184532-3qm9l8n",
|
||||
"title": "Template snippet",
|
||||
"type": "doc",
|
||||
"updated": "20250115153127"
|
||||
"updated": "20250331163727"
|
||||
},
|
||||
"Children": [
|
||||
{
|
||||
|
@ -57,7 +57,7 @@
|
|||
"HeadingLevel": 2,
|
||||
"Properties": {
|
||||
"id": "20210104091444-jy56z0p",
|
||||
"updated": "20241225192808"
|
||||
"updated": "20250331163727"
|
||||
},
|
||||
"Children": [
|
||||
{
|
||||
|
@ -215,7 +215,7 @@
|
|||
"ListData": {},
|
||||
"Properties": {
|
||||
"id": "20210104091444-mwbvc9m",
|
||||
"updated": "20241225192808"
|
||||
"updated": "20250331163727"
|
||||
},
|
||||
"Children": [
|
||||
{
|
||||
|
@ -249,15 +249,7 @@
|
|||
},
|
||||
{
|
||||
"Type": "NodeText",
|
||||
"Data": ": Use this variable to insert the current document name. For example, if the "
|
||||
},
|
||||
{
|
||||
"Type": "NodeText",
|
||||
"Data": "template"
|
||||
},
|
||||
{
|
||||
"Type": "NodeText",
|
||||
"Data": " content is "
|
||||
"Data": ": Use this variable to insert the current document name. For example, if the template content is "
|
||||
},
|
||||
{
|
||||
"Type": "NodeTextMark",
|
||||
|
@ -429,7 +421,7 @@
|
|||
},
|
||||
"Properties": {
|
||||
"id": "20210121193829-wfzsf6m",
|
||||
"updated": "20240403150956"
|
||||
"updated": "20250331163727"
|
||||
},
|
||||
"Children": [
|
||||
{
|
||||
|
@ -451,15 +443,7 @@
|
|||
},
|
||||
{
|
||||
"Type": "NodeText",
|
||||
"Data": ": This function is used to query the "
|
||||
},
|
||||
{
|
||||
"Type": "NodeText",
|
||||
"Data": "database"
|
||||
},
|
||||
{
|
||||
"Type": "NodeText",
|
||||
"Data": ", and the return value is a list of blocks"
|
||||
"Data": ": This function is used to query the database, and the return value is a list of blocks"
|
||||
}
|
||||
]
|
||||
},
|
||||
|
@ -470,7 +454,7 @@
|
|||
"Properties": {
|
||||
"id": "20241213215602-dk7iion",
|
||||
"style": "line-height: 22px;",
|
||||
"updated": "20241213215602"
|
||||
"updated": "20250331163727"
|
||||
},
|
||||
"Children": [
|
||||
{
|
||||
|
@ -482,7 +466,70 @@
|
|||
},
|
||||
{
|
||||
"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"
|
||||
"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": "```"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"ID": "20250331163529-vixv1we",
|
||||
"Type": "NodeListItem",
|
||||
"ListData": {
|
||||
"BulletChar": 42,
|
||||
"Marker": "Kg=="
|
||||
},
|
||||
"Properties": {
|
||||
"id": "20250331163529-vixv1we",
|
||||
"updated": "20250331163604"
|
||||
},
|
||||
"Children": [
|
||||
{
|
||||
"ID": "20250331163529-m6ezl4h",
|
||||
"Type": "NodeParagraph",
|
||||
"Properties": {
|
||||
"id": "20250331163529-m6ezl4h",
|
||||
"updated": "20250331163547"
|
||||
},
|
||||
"Children": [
|
||||
{
|
||||
"Type": "NodeText",
|
||||
"Data": ""
|
||||
},
|
||||
{
|
||||
"Type": "NodeTextMark",
|
||||
"TextMarkType": "code",
|
||||
"TextMarkTextContent": "getBlock"
|
||||
},
|
||||
{
|
||||
"Type": "NodeText",
|
||||
"Data": ": This function is used to query the database based on the block ID, and the return value is block"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"ID": "20250331163550-2r69a54",
|
||||
"Type": "NodeCodeBlock",
|
||||
"IsFencedCodeBlock": true,
|
||||
"Properties": {
|
||||
"id": "20250331163550-2r69a54",
|
||||
"updated": "20250331163604"
|
||||
},
|
||||
"Children": [
|
||||
{
|
||||
"Type": "NodeCodeBlockFenceOpenMarker",
|
||||
"Data": "```"
|
||||
},
|
||||
{
|
||||
"Type": "NodeCodeBlockFenceInfoMarker"
|
||||
},
|
||||
{
|
||||
"Type": "NodeCodeBlockCode",
|
||||
"Data": ".action{getBlock \"20250331163529-vixv1we\"}\n"
|
||||
},
|
||||
{
|
||||
"Type": "NodeCodeBlockFenceCloseMarker",
|
||||
|
@ -523,15 +570,7 @@
|
|||
},
|
||||
{
|
||||
"Type": "NodeText",
|
||||
"Data": ": This function is used to query the "
|
||||
},
|
||||
{
|
||||
"Type": "NodeText",
|
||||
"Data": "database"
|
||||
},
|
||||
{
|
||||
"Type": "NodeText",
|
||||
"Data": ", and the return value is a list of spans"
|
||||
"Data": ": This function is used to query the database, and the return value is a list of spans"
|
||||
}
|
||||
]
|
||||
},
|
||||
|
@ -595,15 +634,7 @@
|
|||
},
|
||||
{
|
||||
"Type": "NodeText",
|
||||
"Data": ": This function is used to query the "
|
||||
},
|
||||
{
|
||||
"Type": "NodeText",
|
||||
"Data": "database"
|
||||
},
|
||||
{
|
||||
"Type": "NodeText",
|
||||
"Data": " and the return value is a result set"
|
||||
"Data": ": This function is used to query the database and the return value is a result set"
|
||||
}
|
||||
]
|
||||
},
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
"id": "20201204181006-7bkppue",
|
||||
"title": "模板片段",
|
||||
"type": "doc",
|
||||
"updated": "20250115153028"
|
||||
"updated": "20250331163228"
|
||||
},
|
||||
"Children": [
|
||||
{
|
||||
|
@ -69,7 +69,7 @@
|
|||
"HeadingLevel": 2,
|
||||
"Properties": {
|
||||
"id": "20210104091309-fhb549c",
|
||||
"updated": "20241225192538"
|
||||
"updated": "20250331163228"
|
||||
},
|
||||
"Children": [
|
||||
{
|
||||
|
@ -237,7 +237,7 @@
|
|||
"ListData": {},
|
||||
"Properties": {
|
||||
"id": "20210104091309-gjkg3u5",
|
||||
"updated": "20241225192538"
|
||||
"updated": "20250331163228"
|
||||
},
|
||||
"Children": [
|
||||
{
|
||||
|
@ -271,15 +271,7 @@
|
|||
},
|
||||
{
|
||||
"Type": "NodeText",
|
||||
"Data": ":该变量用于插入当前文档名。比如"
|
||||
},
|
||||
{
|
||||
"Type": "NodeText",
|
||||
"Data": "模板"
|
||||
},
|
||||
{
|
||||
"Type": "NodeText",
|
||||
"Data": "内容为 "
|
||||
"Data": ":该变量用于插入当前文档名。比如模板内容为 "
|
||||
},
|
||||
{
|
||||
"Type": "NodeTextMark",
|
||||
|
@ -451,7 +443,7 @@
|
|||
},
|
||||
"Properties": {
|
||||
"id": "20210121193601-uwo8s5h",
|
||||
"updated": "20240403150712"
|
||||
"updated": "20250331163052"
|
||||
},
|
||||
"Children": [
|
||||
{
|
||||
|
@ -473,15 +465,7 @@
|
|||
},
|
||||
{
|
||||
"Type": "NodeText",
|
||||
"Data": ":该函数用于查询"
|
||||
},
|
||||
{
|
||||
"Type": "NodeText",
|
||||
"Data": "数据库"
|
||||
},
|
||||
{
|
||||
"Type": "NodeText",
|
||||
"Data": ",返回值为 blocks 列表"
|
||||
"Data": ":该函数用于查询数据库,返回值为 blocks 列表"
|
||||
}
|
||||
]
|
||||
},
|
||||
|
@ -492,7 +476,7 @@
|
|||
"Properties": {
|
||||
"id": "20210604111446-p6vadfc",
|
||||
"style": "line-height: 22px;",
|
||||
"updated": "20241213215118"
|
||||
"updated": "20250331163052"
|
||||
},
|
||||
"Children": [
|
||||
{
|
||||
|
@ -504,7 +488,70 @@
|
|||
},
|
||||
{
|
||||
"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"
|
||||
"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": "```"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"ID": "20250331162928-53comqi",
|
||||
"Type": "NodeListItem",
|
||||
"ListData": {
|
||||
"BulletChar": 42,
|
||||
"Marker": "Kg=="
|
||||
},
|
||||
"Properties": {
|
||||
"id": "20250331162928-53comqi",
|
||||
"updated": "20250331163228"
|
||||
},
|
||||
"Children": [
|
||||
{
|
||||
"ID": "20250331162928-8ugpm3u",
|
||||
"Type": "NodeParagraph",
|
||||
"Properties": {
|
||||
"id": "20250331162928-8ugpm3u",
|
||||
"updated": "20250331163210"
|
||||
},
|
||||
"Children": [
|
||||
{
|
||||
"Type": "NodeText",
|
||||
"Data": ""
|
||||
},
|
||||
{
|
||||
"Type": "NodeTextMark",
|
||||
"TextMarkType": "code",
|
||||
"TextMarkTextContent": "getBlock"
|
||||
},
|
||||
{
|
||||
"Type": "NodeText",
|
||||
"Data": ":该函数用于根据块 ID 查询数据库,返回值为 block"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"ID": "20250331163038-6j2ttlc",
|
||||
"Type": "NodeCodeBlock",
|
||||
"IsFencedCodeBlock": true,
|
||||
"Properties": {
|
||||
"id": "20250331163038-6j2ttlc",
|
||||
"updated": "20250331163228"
|
||||
},
|
||||
"Children": [
|
||||
{
|
||||
"Type": "NodeCodeBlockFenceOpenMarker",
|
||||
"Data": "```"
|
||||
},
|
||||
{
|
||||
"Type": "NodeCodeBlockFenceInfoMarker"
|
||||
},
|
||||
{
|
||||
"Type": "NodeCodeBlockCode",
|
||||
"Data": ".action{getBlock \"20250331162928-53comqi\"}\n"
|
||||
},
|
||||
{
|
||||
"Type": "NodeCodeBlockFenceCloseMarker",
|
||||
|
@ -545,15 +592,7 @@
|
|||
},
|
||||
{
|
||||
"Type": "NodeText",
|
||||
"Data": ":该函数用于查询"
|
||||
},
|
||||
{
|
||||
"Type": "NodeText",
|
||||
"Data": "数据库"
|
||||
},
|
||||
{
|
||||
"Type": "NodeText",
|
||||
"Data": ",返回值为 spans 列表"
|
||||
"Data": ":该函数用于查询数据库,返回值为 spans 列表"
|
||||
}
|
||||
]
|
||||
},
|
||||
|
@ -617,15 +656,7 @@
|
|||
},
|
||||
{
|
||||
"Type": "NodeText",
|
||||
"Data": ":该函数用于查询"
|
||||
},
|
||||
{
|
||||
"Type": "NodeText",
|
||||
"Data": "数据库"
|
||||
},
|
||||
{
|
||||
"Type": "NodeText",
|
||||
"Data": ",返回值为结果集"
|
||||
"Data": ":该函数用于查询数据库,返回值为结果集"
|
||||
}
|
||||
]
|
||||
},
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
"id": "20211226123004-dplpw0o",
|
||||
"title": "範本片段",
|
||||
"type": "doc",
|
||||
"updated": "20250115153115"
|
||||
"updated": "20250331163725"
|
||||
},
|
||||
"Children": [
|
||||
{
|
||||
|
@ -53,7 +53,7 @@
|
|||
"HeadingLevel": 2,
|
||||
"Properties": {
|
||||
"id": "20211226123024-eyagqur",
|
||||
"updated": "20241225192757"
|
||||
"updated": "20250331163725"
|
||||
},
|
||||
"Children": [
|
||||
{
|
||||
|
@ -208,7 +208,7 @@
|
|||
"ListData": {},
|
||||
"Properties": {
|
||||
"id": "20211226123024-pjvw31z",
|
||||
"updated": "20241225192757"
|
||||
"updated": "20250331163725"
|
||||
},
|
||||
"Children": [
|
||||
{
|
||||
|
@ -414,7 +414,7 @@
|
|||
},
|
||||
"Properties": {
|
||||
"id": "20211226123024-e42d7xq",
|
||||
"updated": "20240403150942"
|
||||
"updated": "20250331163725"
|
||||
},
|
||||
"Children": [
|
||||
{
|
||||
|
@ -436,15 +436,7 @@
|
|||
},
|
||||
{
|
||||
"Type": "NodeText",
|
||||
"Data": ":該函數用於查詢"
|
||||
},
|
||||
{
|
||||
"Type": "NodeText",
|
||||
"Data": "資料庫"
|
||||
},
|
||||
{
|
||||
"Type": "NodeText",
|
||||
"Data": ",返回值為 blocks 列表"
|
||||
"Data": ":該函數用於查詢資料庫,返回值為 blocks 列表"
|
||||
}
|
||||
]
|
||||
},
|
||||
|
@ -455,7 +447,7 @@
|
|||
"Properties": {
|
||||
"id": "20241213215519-mfgruqs",
|
||||
"style": "line-height: 22px;",
|
||||
"updated": "20241213215519"
|
||||
"updated": "20250331163725"
|
||||
},
|
||||
"Children": [
|
||||
{
|
||||
|
@ -467,7 +459,70 @@
|
|||
},
|
||||
{
|
||||
"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"
|
||||
"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": "```"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"ID": "20250331163425-s5u08ng",
|
||||
"Type": "NodeListItem",
|
||||
"ListData": {
|
||||
"BulletChar": 42,
|
||||
"Marker": "Kg=="
|
||||
},
|
||||
"Properties": {
|
||||
"id": "20250331163425-s5u08ng",
|
||||
"updated": "20250331163515"
|
||||
},
|
||||
"Children": [
|
||||
{
|
||||
"ID": "20250331163425-6fe2kvm",
|
||||
"Type": "NodeParagraph",
|
||||
"Properties": {
|
||||
"id": "20250331163425-6fe2kvm",
|
||||
"updated": "20250331163515"
|
||||
},
|
||||
"Children": [
|
||||
{
|
||||
"Type": "NodeText",
|
||||
"Data": ""
|
||||
},
|
||||
{
|
||||
"Type": "NodeTextMark",
|
||||
"TextMarkType": "code",
|
||||
"TextMarkTextContent": "getBlock"
|
||||
},
|
||||
{
|
||||
"Type": "NodeText",
|
||||
"Data": ":函數用於根據塊 ID 查詢資料庫,傳回值為 block"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"ID": "20250331163435-irjmxt9",
|
||||
"Type": "NodeCodeBlock",
|
||||
"IsFencedCodeBlock": true,
|
||||
"Properties": {
|
||||
"id": "20250331163435-irjmxt9",
|
||||
"updated": "20250331163452"
|
||||
},
|
||||
"Children": [
|
||||
{
|
||||
"Type": "NodeCodeBlockFenceOpenMarker",
|
||||
"Data": "```"
|
||||
},
|
||||
{
|
||||
"Type": "NodeCodeBlockFenceInfoMarker"
|
||||
},
|
||||
{
|
||||
"Type": "NodeCodeBlockCode",
|
||||
"Data": ".action{getBlock \"20250331163425-s5u08ng\"}\n"
|
||||
},
|
||||
{
|
||||
"Type": "NodeCodeBlockFenceCloseMarker",
|
||||
|
@ -508,15 +563,7 @@
|
|||
},
|
||||
{
|
||||
"Type": "NodeText",
|
||||
"Data": ":該函數用於查詢"
|
||||
},
|
||||
{
|
||||
"Type": "NodeText",
|
||||
"Data": "資料庫"
|
||||
},
|
||||
{
|
||||
"Type": "NodeText",
|
||||
"Data": ",返回值為 spans 列表"
|
||||
"Data": ":該函數用於查詢資料庫,返回值為 spans 列表"
|
||||
}
|
||||
]
|
||||
},
|
||||
|
@ -580,15 +627,7 @@
|
|||
},
|
||||
{
|
||||
"Type": "NodeText",
|
||||
"Data": ":函數用於查詢"
|
||||
},
|
||||
{
|
||||
"Type": "NodeText",
|
||||
"Data": "資料庫"
|
||||
},
|
||||
{
|
||||
"Type": "NodeText",
|
||||
"Data": ",傳回值為結果集"
|
||||
"Data": ":函數用於查詢資料庫,傳回值為結果集"
|
||||
}
|
||||
]
|
||||
},
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
"id": "20240530101000-6x9ivi7",
|
||||
"title": "テンプレートスニペット",
|
||||
"type": "doc",
|
||||
"updated": "20241225192831"
|
||||
"updated": "20250331163729"
|
||||
},
|
||||
"Children": [
|
||||
{
|
||||
|
@ -66,7 +66,7 @@
|
|||
"Properties": {
|
||||
"ID": "20240530101000-5nvn9ad",
|
||||
"id": "20240530101000-pi05yzt",
|
||||
"updated": "20241225192831"
|
||||
"updated": "20250331163729"
|
||||
},
|
||||
"Children": [
|
||||
{
|
||||
|
@ -226,7 +226,7 @@
|
|||
"ListData": {},
|
||||
"Properties": {
|
||||
"id": "20240530101000-by5hqnb",
|
||||
"updated": "20241225192831"
|
||||
"updated": "20250331163729"
|
||||
},
|
||||
"Children": [
|
||||
{
|
||||
|
@ -432,7 +432,7 @@
|
|||
},
|
||||
"Properties": {
|
||||
"id": "20240530101000-0y2zlji",
|
||||
"updated": "20240530101000"
|
||||
"updated": "20250331163729"
|
||||
},
|
||||
"Children": [
|
||||
{
|
||||
|
@ -454,15 +454,7 @@
|
|||
},
|
||||
{
|
||||
"Type": "NodeText",
|
||||
"Data": ": この関数は"
|
||||
},
|
||||
{
|
||||
"Type": "NodeText",
|
||||
"Data": "データベース"
|
||||
},
|
||||
{
|
||||
"Type": "NodeText",
|
||||
"Data": "をクエリしてブロックのリストを返します"
|
||||
"Data": ": この関数はデータベースをクエリしてブロックのリストを返します"
|
||||
}
|
||||
]
|
||||
},
|
||||
|
@ -473,7 +465,7 @@
|
|||
"Properties": {
|
||||
"id": "20241213215628-5gixpmp",
|
||||
"style": "line-height: 22px;",
|
||||
"updated": "20241213215628"
|
||||
"updated": "20250331163729"
|
||||
},
|
||||
"Children": [
|
||||
{
|
||||
|
@ -485,7 +477,70 @@
|
|||
},
|
||||
{
|
||||
"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"
|
||||
"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": "```"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"ID": "20250331163610-n3e9zft",
|
||||
"Type": "NodeListItem",
|
||||
"ListData": {
|
||||
"BulletChar": 42,
|
||||
"Marker": "Kg=="
|
||||
},
|
||||
"Properties": {
|
||||
"id": "20250331163610-n3e9zft",
|
||||
"updated": "20250331163642"
|
||||
},
|
||||
"Children": [
|
||||
{
|
||||
"ID": "20250331163610-nbmwe90",
|
||||
"Type": "NodeParagraph",
|
||||
"Properties": {
|
||||
"id": "20250331163610-nbmwe90",
|
||||
"updated": "20250331163621"
|
||||
},
|
||||
"Children": [
|
||||
{
|
||||
"Type": "NodeText",
|
||||
"Data": ""
|
||||
},
|
||||
{
|
||||
"Type": "NodeTextMark",
|
||||
"TextMarkType": "code",
|
||||
"TextMarkTextContent": "getBlock"
|
||||
},
|
||||
{
|
||||
"Type": "NodeText",
|
||||
"Data": ": この関数はブロックIDに基づいてデータベースを照会するために使用され、戻り値はブロックです"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"ID": "20250331163621-j4iofxv",
|
||||
"Type": "NodeCodeBlock",
|
||||
"IsFencedCodeBlock": true,
|
||||
"Properties": {
|
||||
"id": "20250331163621-j4iofxv",
|
||||
"updated": "20250331163642"
|
||||
},
|
||||
"Children": [
|
||||
{
|
||||
"Type": "NodeCodeBlockFenceOpenMarker",
|
||||
"Data": "```"
|
||||
},
|
||||
{
|
||||
"Type": "NodeCodeBlockFenceInfoMarker"
|
||||
},
|
||||
{
|
||||
"Type": "NodeCodeBlockCode",
|
||||
"Data": ".action{getBlock \"20250331163610-n3e9zft\"}\n"
|
||||
},
|
||||
{
|
||||
"Type": "NodeCodeBlockFenceCloseMarker",
|
||||
|
@ -526,15 +581,7 @@
|
|||
},
|
||||
{
|
||||
"Type": "NodeText",
|
||||
"Data": ": この関数は"
|
||||
},
|
||||
{
|
||||
"Type": "NodeText",
|
||||
"Data": "データベース"
|
||||
},
|
||||
{
|
||||
"Type": "NodeText",
|
||||
"Data": "をクエリしてスパンのリストを返します"
|
||||
"Data": ": この関数はデータベースをクエリしてスパンのリストを返します"
|
||||
}
|
||||
]
|
||||
},
|
||||
|
@ -598,15 +645,7 @@
|
|||
},
|
||||
{
|
||||
"Type": "NodeText",
|
||||
"Data": ": この関数は"
|
||||
},
|
||||
{
|
||||
"Type": "NodeText",
|
||||
"Data": "データベース"
|
||||
},
|
||||
{
|
||||
"Type": "NodeText",
|
||||
"Data": "へのクエリに使用され、戻り値は結果セットです"
|
||||
"Data": ": この関数はデータベースへのクエリに使用され、戻り値は結果セットです"
|
||||
}
|
||||
]
|
||||
},
|
||||
|
|
|
@ -1518,6 +1518,17 @@ func SQLTemplateFuncs(templateFuncMap *template.FuncMap) {
|
|||
retBlocks = SelectBlocksRawStmt(stmt, 1, 512)
|
||||
return
|
||||
}
|
||||
(*templateFuncMap)["getBlock"] = func(arg any) (retBlock *Block) {
|
||||
switch v := arg.(type) {
|
||||
case string:
|
||||
retBlock = GetBlock(v)
|
||||
case map[string]interface{}:
|
||||
if id, ok := v["id"]; ok {
|
||||
retBlock = GetBlock(id.(string))
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
(*templateFuncMap)["querySpans"] = func(stmt string, args ...string) (retSpans []*Span) {
|
||||
for _, arg := range args {
|
||||
stmt = strings.Replace(stmt, "?", arg, 1)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue