Documentation
¶
Index ¶
- Constants
- Variables
- func BatchGetBlockAttrs(ids []string) (ret map[string]map[string]string)
- func BatchGetBlockAttrsWitTrees(ids []string, trees map[string]*parse.Tree) (ret map[string]map[string]string)
- func BatchRemoveAssetsQueue(hashes []string)
- func BatchRemoveTreeQueue(rootIDs []string)
- func CacheRef(tree *parse.Tree, refNode *ast.Node)
- func CheckAssetContentReadonlyStatement(stmt string) error
- func CheckReadonlyStatement(stmt string) error
- func CheckReadonlyStatementInBox(stmt, boxID string) error
- func CheckSingleStatement(stmt string) error
- func ClearCache()
- func ClearQueue()
- func CloseDatabase()
- func CloseEncryptedDB(boxID string)
- func DefRefs(condition string, limit int) (ret []map[*Block]*Block)
- func DeleteAssetContentsByPathQueue(path string)
- func DeleteBoxQueue(boxID string)
- func DeleteBoxRefsQueue(boxID string)
- func DeleteOutdatedHistories(before int64)
- func DeleteRefsTreeQueue(tree *parse.Tree)
- func Exec(stmt string, args ...any) error
- func ExistRefByDefIDs(defIDs, defRootIDs, excludeBlockIDs, excludeRootIDs []string) (ret bool, err error)
- func ExistRefByDefIDsInBox(defIDs, defRootIDs, excludeBlockIDs, excludeRootIDs []string, boxID string) (ret bool, err error)
- func FillAttributeViewNilValue(value *av.Value, typ av.KeyType)
- func FlushAssetContentQueue()
- func FlushAssetContentTxJob()
- func FlushHistoryQueue()
- func FlushHistoryTxJob()
- func FlushQueue()
- func FlushTxJob()
- func GetBlockAttrs(id string) (ret map[string]string)
- func GetContainerText(container *ast.Node) string
- func GetDuplicatedRootIDs(blocksTable string) (ret []string)
- func GetEncryptedBoxIDs() (ret []string)
- func GetEncryptedDB(boxID string) *sql.DB
- func GetFurtherCollections(attrView *av.AttributeView, cachedAttrViews map[string]*av.AttributeView) map[string]*av.RollupRenderContext
- func GetRefDuplicatedDefRootIDs() (ret []string)
- func GetRefText(defBlockID string) (ret string)
- func GetRefTextInBox(defBlockID, boxID string) (ret string)
- func GetRootUpdated() (ret map[string]string, err error)
- func GetTemplateKeyRelevantKeys(attrView *av.AttributeView, templateKey *av.Key) (ret []*av.Key)
- func GetTemplateKeysByResolutionOrder(attrView *av.AttributeView) (ret []*av.Key, resolved bool)
- func IndexAssetContentsQueue(assetContents []*AssetContent)
- func IndexHistoriesQueue(histories []*History)
- func IndexNodeQueue(id string)
- func IndexTreeQueue(tree *parse.Tree)
- func InitAssetContentDatabase(forceRebuild bool)
- func InitDatabase(forceRebuild bool)
- func InitHistoryDatabase(forceRebuild bool)
- func MoveTreeQueue(tree *parse.Tree)
- func NodeStaticContent(node *ast.Node, excludeTypes []string, ...) string
- func OpenEncryptedDB(boxID string, dek []byte) (err error)
- func Query(stmt string, limit int) (ret []map[string]any, err error)
- func QueryAssetContentNoLimit(stmt string) (ret []map[string]any, err error)
- func QueryAssetContentNoLimitArgs(stmt string, args ...any) (ret []map[string]any, err error)
- func QueryBlockAliases(rootID string) (ret []string)
- func QueryBlockAliasesInBox(rootID, boxID string) (ret []string)
- func QueryBlockDefIDsByRefText(refText string) (ret []string)
- func QueryBlockDefIDsByRefTextInBox(refText, boxID string) (ret []string)
- func QueryBlockNamesByRootID(rootID string) (ret []string)
- func QueryBlockNamesByRootIDInBox(rootID, boxID string) (ret []string)
- func QueryBookmarkLabels() (ret []string)
- func QueryBoundBlockAVIDs(blockIDs, rootIDs []string) (ret map[string][]string, err error)
- func QueryBoundBlockAVIDsInBox(blockIDs, rootIDs []string, boxID string) (ret map[string][]string, err error)
- func QueryChildDefIDsByRootDefID(rootDefID string) (ret []string)
- func QueryChildRefDefIDsByRootDefID(rootDefID string) (ret map[string][]string)
- func QueryChildRefDefIDsByRootDefIDInBox(rootDefID, boxID string) (ret map[string][]string)
- func QueryHistory(stmt string) (ret []map[string]any, err error)
- func QueryNoLimit(stmt string) (ret []map[string]any, err error)
- func QueryNoLimitArgs(stmt string, args ...any) (ret []map[string]any, err error)
- func QueryNoLimitArgsInBox(stmt, boxID string, args ...any) (ret []map[string]any, err error)
- func QueryNoLimitInBox(stmt, boxID string) (ret []map[string]any, err error)
- func QueryNoLimitInBoxContext(ctx context.Context, stmt, boxID string) (ret []map[string]any, err error)
- func QueryRefCount(defIDs []string) (ret map[string]int)
- func QueryRefCountInBox(defIDs []string, boxID string) (ret map[string]int)
- func QueryRefIDsByAnnotationID(annotationID string) (refIDs []string)
- func QueryRefIDsByAnnotationIDInBox(annotationID, boxID string) (refIDs []string)
- func QueryRefIDsByDefID(defID string, containChildren bool) (refIDs []string)
- func QueryRefIDsByDefIDInBox(defID string, containChildren bool, boxID string) (refIDs []string)
- func QueryRefRootBlocksByDefRootIDs(defRootIDs []string) (ret map[string][]*Block)
- func QueryRootBlockRefCount() (ret map[string]int)
- func QueryRootChildrenRefCount(defRootID string) (ret map[string]int)
- func QueryRootChildrenRefCountInBox(defRootID, boxID string) (ret map[string]int)
- func QueryVirtualRefKeywords(name, alias, anchor, doc bool, ...) (ret []string)
- func RebuildFTSIndex() (err error)
- func RemoveAllEncryptedDBFiles()
- func RemoveEncryptedDBFile(boxID string)
- func RemoveTreePathQueue(treeBox, treePathPrefix string)
- func RemoveTreeQueue(boxID, rootID string)
- func RenameTreeQueue(tree *parse.Tree)
- func RenderAttributeViewGallery(attrView *av.AttributeView, view *av.View, query string, depth *int, ...) (ret *av.Gallery)
- func RenderAttributeViewKanban(attrView *av.AttributeView, view *av.View, query string, depth *int, ...) (ret *av.Kanban)
- func RenderAttributeViewTable(attrView *av.AttributeView, view *av.View, query string, depth *int, ...) (ret *av.Table)
- func RenderGroupView(attrView *av.AttributeView, view, groupView *av.View, query string) (ret av.Viewable)
- func RenderView(attrView *av.AttributeView, view *av.View, query string, ignoreRows bool) (ret av.Viewable)
- func SQLTemplateFuncs(templateFuncMap *template.FuncMap, boxIDs ...string)
- func SetCaseSensitive(b bool)
- func SetHanSensitive(b bool)
- func SetIndexAssetPath(b bool)
- func UpdateBlockContentQueue(block *Block)
- func UpdateRefsTreeQueue(tree *parse.Tree)
- func UpsertTreeQueue(tree *parse.Tree)
- func Vacuum()
- func WaitFlushTx()
- type Asset
- type AssetContent
- type Attribute
- type Block
- func BuildBlockFromNode(n *ast.Node, tree *parse.Tree) (block *Block)
- func GetAllChildBlocks(rootIDs []string, condition string, limit int) (ret []*Block)
- func GetAllRootBlocks() (ret []*Block)
- func GetBlock(id string) (ret *Block)
- func GetBlockInBox(id, boxID string) (ret *Block)
- func GetBlocks(ids []string) (ret []*Block)
- func GetBlocksInBox(ids []string, boxID string) (ret []*Block)
- func GetChildBlocks(parentID, condition string, limit int) (ret []*Block)
- func GetChildBlocksInBox(parentID, condition string, limit int, boxID string) (ret []*Block)
- func QueryBookmarkBlocks() (ret []*Block)
- func QueryDefRootBlocksByRefRootID(refRootID string) (ret []*Block)
- func QueryEmptyContentEmbedBlocks() (ret []*Block)
- func QueryEmptyContentEmbedBlocksInBox(boxID string) (ret []*Block)
- func QueryRootBlockByCondition(condition, exactKeyword string, limit int, args ...any) (ret []*Block)
- func QueryRootBlockByConditionInBox(condition, exactKeyword string, limit int, boxID string, args ...any) (ret []*Block)
- func SelectBlocksRawStmt(stmt string, page, limit int) (ret []*Block)
- func SelectBlocksRawStmtArgs(stmt string, args []any, limit int) (ret []*Block)
- func SelectBlocksRawStmtArgsInBox(stmt string, args []any, limit int, boxID string) (ret []*Block)
- func SelectBlocksRawStmtInBox(stmt string, page, limit int, boxID string) (ret []*Block)
- func SelectBlocksRawStmtInBoxContext(ctx context.Context, stmt string, page, limit int, boxID string) (ret []*Block, err error)
- func SelectBlocksRawStmtNoParse(stmt string, limit int) (ret []*Block)
- func SelectBlocksRawStmtNoParseInBox(stmt string, limit int, boxID string) (ret []*Block)
- func SelectBlocksRegex(stmt string, exp *regexp.Regexp, name, alias, memo, ial bool, ...) (ret []*Block)
- func SelectBlocksRegexArgs(stmt string, exp *regexp.Regexp, name, alias, memo, ial bool, ...) (ret []*Block)
- func SelectBlocksRegexArgsInBox(stmt string, exp *regexp.Regexp, name, alias, memo, ial bool, ...) (ret []*Block)
- func SelectBlocksRegexInBox(stmt string, exp *regexp.Regexp, name, alias, memo, ial bool, ...) (ret []*Block)
- func ToBlocks(result []map[string]any) (ret []*Block)
- type BookmarkLabelBlock
- type FileAnnotationRef
- type History
- type Ref
- func GetRefsCacheByDefID(defID string) (ret []*Ref)
- func GetRefsCacheByDefIDInBox(defID, boxID string) (ret []*Ref)
- func QueryRefsByDefID(defBlockID string, containChildren bool) (ret []*Ref)
- func QueryRefsByDefIDInBox(defBlockID string, containChildren bool, boxID string) (ret []*Ref)
- func QueryRefsByDefIDRefID(defBlockID, refBlockID string) (ret []*Ref)
- func QueryRefsByDefIDRefIDInBox(defBlockID, refBlockID, boxID string) (ret []*Ref)
- func QueryRefsRecent(onlyDoc bool, typeFilter string, ignoreLines []string) (ret []*Ref)
- func QueryRefsRecentInBox(onlyDoc bool, typeFilter string, ignoreLines, recentDefBlockIDs []string, ...) (ret []*Ref)
- type Span
- func QueryTagSpans(p string) (ret []*Span)
- func QueryTagSpansByKeyword(keyword string, limit int) (ret []*Span)
- func QueryTagSpansByLabel(label string) (ret []*Span)
- func SelectSpansRawStmt(stmt string, limit int) (ret []*Span)
- func SelectSpansRawStmtInBox(stmt string, limit int, boxID string) (ret []*Span)
- type Stat
Constants ¶
const ( AssetContentsFTSCaseInsensitiveInsert = "INSERT INTO asset_contents_fts_case_insensitive (id, name, ext, path, size, updated, content) VALUES %s" AssetContentsPlaceholder = "(?, ?, ?, ?, ?, ?, ?)" )
const ( HistoriesFTSCaseInsensitiveInsert = "INSERT INTO histories_fts_case_insensitive (id, type, op, title, content, path, created) VALUES %s" HistoriesPlaceholder = "(?, ?, ?, ?, ?, ?, ?)" )
const ( BlocksInsert = "" /* 182-byte string literal not displayed */ BlocksPlaceholder = "(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)" // blocks_fts 采用 external content 模式(content='blocks'),写入时必须显式提供 rowid, // 该 rowid 取自 blocks 表的隐式 rowid,否则 FTS rowid 与 blocks rowid 脱钩会导致 // snippet/highlight 回表取错行、按 rowid 删除静默失效。首列即为 rowid。 BlocksFTSInsert = "" /* 193-byte string literal not displayed */ BlocksFTSPlaceholder = "(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)" SpansInsert = "INSERT INTO spans (id, block_id, root_id, box, path, content, markdown, type, ial) VALUES %s" SpansPlaceholder = "(?, ?, ?, ?, ?, ?, ?, ?, ?)" AssetsPlaceholder = "(?, ?, ?, ?, ?, ?, ?, ?, ?)" AttributesPlaceholder = "(?, ?, ?, ?, ?, ?, ?, ?)" RefsPlaceholder = "(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)" FileAnnotationRefsPlaceholder = "(?, ?, ?, ?, ?, ?, ?, ?, ?)" )
Variables ¶
var ( // IsEncryptedBoxFn 由 model 层注入,用于判断 boxID 是否为加密笔记本。 // sql 包不直接 import model(循环依赖),路由函数据此 fail-closed: // 加密笔记本未解锁时绝不回退全局库,避免加密笔记本索引污染全局明文库。 IsEncryptedBoxFn func(boxID string) bool // IsBoxUnlockedFn 由 model 层注入,用于在读取明文缓存前确认加密笔记本仍处于解锁状态。 IsBoxUnlockedFn func(boxID string) bool )
var (
IndexIgnoreCached bool
)
Functions ¶
func BatchRemoveAssetsQueue ¶
func BatchRemoveAssetsQueue(hashes []string)
func BatchRemoveTreeQueue ¶
func BatchRemoveTreeQueue(rootIDs []string)
func CheckAssetContentReadonlyStatement ¶
CheckAssetContentReadonlyStatement 在资源文件内容数据库连接上检查 SQL 是否只读。
func CheckReadonlyStatement ¶
CheckReadonlyStatement 对整段 SQL 做 prepare(不执行),用 sqlite3_stmt_readonly 判断首条语句是否只读。 见 https://sqlite.org/c3ref/stmt_readonly.html
注意:若字符串里在语法上还有第二条及以后的语句,本函数只针对「首条」对应的 stmt 做判断, 不会拒绝多语句。与 CheckSingleStatement 组合即可得到「单条 + 只读」策略。 仅允许 SELECT 和 WITH 查询,避免 SQLite 将 ATTACH、DETACH 和事务控制语句标记为只读后放行。
func CheckReadonlyStatementInBox ¶
CheckReadonlyStatementInBox 在指定笔记本对应的数据库连接上检查 SQL 是否只读。
func CheckSingleStatement ¶
func ClearCache ¶
func ClearCache()
func ClearQueue ¶
func ClearQueue()
func CloseDatabase ¶
func CloseDatabase()
func CloseEncryptedDB ¶
func CloseEncryptedDB(boxID string)
CloseEncryptedDB 仅关闭加密笔记本的 db 连接(不删文件)。UnlockBox 创建失败回滚时调用。 关闭/锁定加密笔记本请用 RemoveEncryptedDBFile(关连接 + 删文件)。
func DeleteAssetContentsByPathQueue ¶
func DeleteAssetContentsByPathQueue(path string)
func DeleteBoxQueue ¶
func DeleteBoxQueue(boxID string)
func DeleteBoxRefsQueue ¶
func DeleteBoxRefsQueue(boxID string)
func DeleteOutdatedHistories ¶
func DeleteOutdatedHistories(before int64)
func DeleteRefsTreeQueue ¶
func ExistRefByDefIDs ¶
func ExistRefByDefIDs(defIDs, defRootIDs, excludeBlockIDs, excludeRootIDs []string) (ret bool, err error)
ExistRefByDefIDs 检查全局库及所有已打开加密库中来自删除集合外部的引用。
func ExistRefByDefIDsInBox ¶
func ExistRefByDefIDsInBox(defIDs, defRootIDs, excludeBlockIDs, excludeRootIDs []string, boxID string) (ret bool, err error)
ExistRefByDefIDsInBox 检查指定笔记本索引中是否存在来自删除集合外部的引用。
func FlushAssetContentQueue ¶
func FlushAssetContentQueue()
func FlushAssetContentTxJob ¶
func FlushAssetContentTxJob()
func FlushHistoryQueue ¶
func FlushHistoryQueue()
func FlushHistoryTxJob ¶
func FlushHistoryTxJob()
func FlushQueue ¶
func FlushQueue()
func FlushTxJob ¶
func FlushTxJob()
func GetBlockAttrs ¶
func GetContainerText ¶
func GetDuplicatedRootIDs ¶
func GetEncryptedBoxIDs ¶
func GetEncryptedBoxIDs() (ret []string)
GetEncryptedBoxIDs 返回所有已打开的加密 content db 对应的 boxID。
func GetEncryptedDB ¶
GetEncryptedDB 返回加密笔记本的 db 句柄;未打开返回 nil。
func GetFurtherCollections ¶
func GetFurtherCollections(attrView *av.AttributeView, cachedAttrViews map[string]*av.AttributeView) map[string]*av.RollupRenderContext
func GetRefDuplicatedDefRootIDs ¶
func GetRefDuplicatedDefRootIDs() (ret []string)
func GetRefText ¶
func GetRefTextInBox ¶
GetRefTextInBox 按 defBlockID 在指定 box 的 db 里查引用文本。
func GetRootUpdated ¶
func GetTemplateKeysByResolutionOrder ¶
func GetTemplateKeysByResolutionOrder(attrView *av.AttributeView) (ret []*av.Key, resolved bool)
func IndexAssetContentsQueue ¶
func IndexAssetContentsQueue(assetContents []*AssetContent)
func IndexHistoriesQueue ¶
func IndexHistoriesQueue(histories []*History)
func IndexNodeQueue ¶
func IndexNodeQueue(id string)
func IndexTreeQueue ¶
func InitAssetContentDatabase ¶
func InitAssetContentDatabase(forceRebuild bool)
func InitDatabase ¶
func InitDatabase(forceRebuild bool)
func InitHistoryDatabase ¶
func InitHistoryDatabase(forceRebuild bool)
func MoveTreeQueue ¶
func NodeStaticContent ¶
func OpenEncryptedDB ¶
OpenEncryptedDB 打开加密笔记本的独立 SQLCipher db 并注册到 encryptedDBs。 dek 是该 box 的 32 字节数据密钥;先用 HKDF 派生 content 子密钥(用途分离),DSN 用 raw key 格式 x'<hex>'。 首次打开会建表(幂等 IF NOT EXISTS)。UnlockBox 时调用。
func QueryAssetContentNoLimitArgs ¶
QueryAssetContentNoLimitArgs 使用绑定参数查询资源文件内容数据库。
func QueryBlockAliases ¶
func QueryBlockAliasesInBox ¶
QueryBlockAliasesInBox 按 rootID 在指定 box 的 db 里查块别名(按逗号拆分去重)。
func QueryBlockNamesByRootID ¶
func QueryBlockNamesByRootIDInBox ¶
QueryBlockNamesByRootIDInBox 按 rootID 在指定 box 的 db 里查块命名。
func QueryBookmarkLabels ¶
func QueryBookmarkLabels() (ret []string)
func QueryBoundBlockAVIDs ¶
QueryBoundBlockAVIDs 查询全局库及所有已打开加密库中删除集合内的数据库绑定块。
func QueryBoundBlockAVIDsInBox ¶
func QueryBoundBlockAVIDsInBox(blockIDs, rootIDs []string, boxID string) (ret map[string][]string, err error)
QueryBoundBlockAVIDsInBox 查询删除集合中绑定块所属的属性视图。
func QueryChildRefDefIDsByRootDefIDInBox ¶
QueryChildRefDefIDsByRootDefIDInBox 按 rootDefID 查子引用定义,按 boxID 路由。
func QueryNoLimitArgs ¶
QueryNoLimitArgs 与 QueryNoLimit 一致,但支持参数化查询(stmt 中用 ? 占位,args 顺序填入)。 用于 embedding 索引器按 fail_count/last_tried 调度时的带参 SELECT。
func QueryNoLimitArgsInBox ¶
QueryNoLimitArgsInBox 与 QueryNoLimitInBox 一致,但支持参数化查询。
func QueryNoLimitInBox ¶
QueryNoLimitInBox 在指定 box 的 db 里执行无 limit 的原始查询(返回 map 行)。
func QueryRefCount ¶
func QueryRefCountInBox ¶
QueryRefCountInBox 按 defBlockIDs 在指定 box 的 db 里查引用计数。
func QueryRefIDsByDefID ¶
func QueryRefIDsByDefIDInBox ¶
QueryRefIDsByDefIDInBox 按 defID 查引用 ID 列表,按 boxID 路由。
func QueryRootBlockRefCount ¶
func QueryRootChildrenRefCountInBox ¶
QueryRootChildrenRefCountInBox 按 defRootID 在指定 box 的 db 里查询根文档下各块的引用计数。
func QueryVirtualRefKeywords ¶
func RebuildFTSIndex ¶
func RebuildFTSIndex() (err error)
func RemoveAllEncryptedDBFiles ¶
func RemoveAllEncryptedDBFiles()
RemoveAllEncryptedDBFiles 关闭所有已打开的加密 content db 连接并删除其文件(含 WAL/SHM)。 进程退出(CloseDatabase)时调用,避免重启后残留旧索引数据导致下次解锁叠加重复行。
func RemoveEncryptedDBFile ¶
func RemoveEncryptedDBFile(boxID string)
RemoveEncryptedDBFile 关闭连接并删除加密 db 文件(含 WAL/SHM)。删除笔记本、关闭加密笔记本时调用。
func RemoveTreePathQueue ¶
func RemoveTreePathQueue(treeBox, treePathPrefix string)
func RemoveTreeQueue ¶
func RemoveTreeQueue(boxID, rootID string)
func RenameTreeQueue ¶
func RenderGroupView ¶
func RenderView ¶
func SQLTemplateFuncs ¶
func SetCaseSensitive ¶
func SetCaseSensitive(b bool)
func SetHanSensitive ¶
func SetHanSensitive(b bool)
func SetIndexAssetPath ¶
func SetIndexAssetPath(b bool)
func UpdateBlockContentQueue ¶
func UpdateBlockContentQueue(block *Block)
func UpdateRefsTreeQueue ¶
func UpsertTreeQueue ¶
func WaitFlushTx ¶
func WaitFlushTx()
Types ¶
type Asset ¶
type Asset struct {
ID string
BlockID string
RootID string
Box string
DocPath string
Path string
Name string
Title string
Hash string
}
func QueryAssetByHash ¶
type AssetContent ¶
type AssetContent struct {
ID string
Name string
Ext string
Path string
Size int64
Updated int64
Content string
}
func SelectAssetContentsRawStmt ¶
func SelectAssetContentsRawStmt(stmt string, page, limit int) (ret []*AssetContent)
func SelectAssetContentsRawStmtNoParse ¶
func SelectAssetContentsRawStmtNoParse(stmt string, limit int) (ret []*AssetContent)
func SelectAssetContentsRawStmtNoParseArgs ¶
func SelectAssetContentsRawStmtNoParseArgs(stmt string, args []any, limit int) (ret []*AssetContent)
SelectAssetContentsRawStmtNoParseArgs 使用绑定参数查询资源文件内容,并保留调用方构造的 SQL。
type Block ¶
type Block struct {
ID string
ParentID string
RootID string
Hash string
Box string
Path string
HPath string
Name string
Alias string
Memo string
Tag string
Content string
FContent string
Markdown string
Length int
Type string
SubType string
IAL string
Sort int
Created string
Updated string
}
func GetAllChildBlocks ¶
func GetAllRootBlocks ¶
func GetAllRootBlocks() (ret []*Block)
func GetBlockInBox ¶
GetBlockInBox 按 id 在指定 box 的 db 里查 block。boxID 为空则查全局 db。
func GetBlocksInBox ¶
GetBlocksInBox 按 ids 在指定 box 的 db 里批量查 block。
func GetChildBlocks ¶
func GetChildBlocksInBox ¶
GetChildBlocksInBox 按 parentID 在指定 box 的 db 里查所有子块。
func QueryBookmarkBlocks ¶
func QueryBookmarkBlocks() (ret []*Block)
func QueryEmptyContentEmbedBlocks ¶
func QueryEmptyContentEmbedBlocks() (ret []*Block)
func SelectBlocksRawStmt ¶
func SelectBlocksRawStmtArgs ¶
SelectBlocksRawStmtArgs 与 selectBlocksRawStmt 行为一致,但通过绑定参数执行, 绕开 sqlparser 解析(vitess 会把 "?" 改写为 ":vN" 导致占位失效),用于含用户可控参数的搜索语句。
func SelectBlocksRawStmtArgsInBox ¶
SelectBlocksRawStmtArgsInBox 在指定 box 的 db 里执行参数化原始 SQL 查询 blocks。 与 SelectBlocksRawStmtArgs 对应,绕开 sqlparser 对 "?" 占位的改写。
func SelectBlocksRawStmtInBox ¶
SelectBlocksRawStmtInBox 在指定 box 的 db 里执行原始 SQL 查询 blocks。
func SelectBlocksRawStmtNoParseInBox ¶
SelectBlocksRawStmtNoParseInBox 与 SelectBlocksRawStmtNoParse 一致,但按 boxID 路由。
func SelectBlocksRegex ¶
func SelectBlocksRegexArgs ¶
func SelectBlocksRegexArgs(stmt string, exp *regexp.Regexp, name, alias, memo, ial bool, page, pageSize int, args ...any) (ret []*Block)
SelectBlocksRegexArgs 与 SelectBlocksRegex 行为一致,但通过绑定参数执行, 绕开 sqlparser 解析(vitess 会把 "?" 改写为 ":vN" 导致占位失效),用于含用户可控参数的正则搜索。
func SelectBlocksRegexArgsInBox ¶
func SelectBlocksRegexArgsInBox(stmt string, exp *regexp.Regexp, name, alias, memo, ial bool, page, pageSize int, boxID string, args ...any) (ret []*Block)
SelectBlocksRegexArgsInBox 与 SelectBlocksRegexInBox 一致,但通过绑定参数执行。
func SelectBlocksRegexInBox ¶
func SelectBlocksRegexInBox(stmt string, exp *regexp.Regexp, name, alias, memo, ial bool, page, pageSize int, boxID string) (ret []*Block)
SelectBlocksRegexInBox 在指定 box 的 db 里执行正则匹配查询 blocks(无占位参数版)。
func (*Block) IsContainerBlock ¶
type BookmarkLabelBlock ¶
func QueryBookmarkLabelBlocks ¶
func QueryBookmarkLabelBlocks() (ret []*BookmarkLabelBlock)
type FileAnnotationRef ¶
type History ¶
type History struct {
ID string
Type int
Op string
Title string
Content string
Created string
Path string
}
func SelectHistoriesRawStmt ¶
type Ref ¶
type Ref struct {
ID string
DefBlockID string
DefBlockParentID string
DefBlockRootID string
DefBlockPath string
BlockID string
RootID string
Box string
Path string
Content string
Markdown string
Type string
}
func GetRefsCacheByDefID ¶
func QueryRefsByDefID ¶
func QueryRefsByDefIDInBox ¶
QueryRefsByDefIDInBox 按 defBlockID 在指定 box 的 db 里查引用列表。 containChildren 为 true 时递归查询定义块及其所有子块,与 QueryRefsByDefID 保持一致。
func QueryRefsByDefIDRefID ¶
func QueryRefsByDefIDRefIDInBox ¶
QueryRefsByDefIDRefIDInBox 按 defBlockID+refBlockID 在指定 box 的 db 里查引用。
func QueryRefsRecent ¶
type Span ¶
type Span struct {
ID string
BlockID string
RootID string
Box string
Path string
Content string
Markdown string
Type string
IAL string
}
func QueryTagSpans ¶
func QueryTagSpansByKeyword ¶
func QueryTagSpansByLabel ¶
func SelectSpansRawStmt ¶
Source Files
¶
- asset.go
- asset_content.go
- asset_content_query.go
- attribute.go
- av.go
- av_gallery.go
- av_kanban.go
- av_table.go
- block.go
- block_query.go
- block_ref.go
- block_ref_query.go
- cache.go
- database.go
- encrypted_query.go
- file_annotation_ref.go
- history.go
- index_queue.go
- queue.go
- queue_asset_content.go
- queue_history.go
- span.go
- stat.go
- stmt_validate.go
- upsert.go