model

package
v0.0.0-...-2c8f587 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 30, 2024 License: AGPL-3.0 Imports: 102 Imported by: 4

Documentation

Index

Constants

View Source
const (
	TxtAssetContentMaxSize = 1024 * 1024 * 4
	PDFAssetContentMaxPage = 1024
)
View Source
const (
	MaskedUserData       = ""
	MaskedAccessAuthCode = "*******"
)
View Source
const (
	HistoryOpClean   = "clean"
	HistoryOpUpdate  = "update"
	HistoryOpDelete  = "delete"
	HistoryOpFormat  = "format"
	HistoryOpSync    = "sync"
	HistoryOpReplace = "replace"
	HistoryOpOutline = "outline"
)
View Source
const (
	HistoryTypeDocName = 0 // Search docs by doc name
	HistoryTypeDoc     = 1 // Search docs by doc name and content
	HistoryTypeAsset   = 2 // Search assets
	HistoryTypeDocID   = 3 // Search docs by doc id
)
View Source
const (
	TxErrCodeBlockNotFound  = 0
	TxErrCodeDataIsSyncing  = 1
	TxErrCodeWriteTree      = 2
	TxErrWriteAttributeView = 3
)

Variables

View Source
var (
	BootSyncSucc = -1 // -1:未执行,0:执行成功,1:执行失败
	ExitSyncSucc = -1
)
View Source
var (
	ErrBoxNotFound   = errors.New("notebook not found")
	ErrBlockNotFound = errors.New("block not found")
	ErrTreeNotFound  = errors.New("tree not found")
	ErrIndexing      = errors.New("indexing")
)
View Source
var (
	AssetsSearchEnabled = true
)
View Source
var CustomEmojis = sync.Map{}
View Source
var (
	Decks = map[string]*riff.Deck{}
)
View Source
var ErrFailedToConnectCloudServer = errors.New("failed to connect cloud server")
View Source
var KernelID = gulu.Rand.String(7)
View Source
var (
	PDFAssetContentMaxSize uint64 = 1024 * 1024 * 128
)

Functions

func AddAttributeViewBlock

func AddAttributeViewBlock(tx *Transaction, srcs []map[string]interface{}, avID, blockID, previousBlockID string, ignoreFillFilter bool) (err error)

func AddAttributeViewKey

func AddAttributeViewKey(avID, keyID, keyName, keyType, keyIcon, previousKeyID string) (err error)

func AddVirtualBlockRefExclude

func AddVirtualBlockRefExclude(keyword []string)

func AddVirtualBlockRefInclude

func AddVirtualBlockRefInclude(keyword []string)

func AutoGenerateFileHistory

func AutoGenerateFileHistory()

func AutoSpace

func AutoSpace(rootID string) (err error)

func BatchExportMarkdown

func BatchExportMarkdown(boxID, folderPath string) (zipPath string)

func BatchSetBlockAttrs

func BatchSetBlockAttrs(blockAttrs []map[string]interface{}) (err error)

func BatchUpdateBazaarPackages

func BatchUpdateBazaarPackages(frontend string)

func BazaarIcons

func BazaarIcons(keyword string) (icons []*bazaar.Icon)

func BazaarPlugins

func BazaarPlugins(frontend, keyword string) (plugins []*bazaar.Plugin)

func BazaarTemplates

func BazaarTemplates(keyword string) (templates []*bazaar.Template)

func BazaarThemes

func BazaarThemes(keyword string) (ret []*bazaar.Theme)

func BazaarWidgets

func BazaarWidgets(keyword string) (widgets []*bazaar.Widget)

func BlocksWordCount

func BlocksWordCount(ids []string) (ret *util.BlockStatResult)

func BookmarkLabels

func BookmarkLabels() (ret []string)

func BootSyncData

func BootSyncData()

func BuildGraph

func BuildGraph(query string) (boxID string, nodes []*GraphNode, links []*GraphLink)

func BuildTreeGraph

func BuildTreeGraph(id, query string) (boxID string, nodes []*GraphNode, links []*GraphLink)

func CacheVirtualBlockRefJob

func CacheVirtualBlockRefJob()

func ChangeBoxSort

func ChangeBoxSort(boxIDs []string)

func ChangeFileTreeSort

func ChangeFileTreeSort(boxID string, paths []string)

func ChangeHistoryTick

func ChangeHistoryTick(minutes int)

func ChatGPT

func ChatGPT(msg string) (ret string)

func ChatGPTWithAction

func ChatGPTWithAction(ids []string, action string) (ret string)

func CheckActivationcode

func CheckActivationcode(code string) (retCode int, msg string)

func CheckAuth

func CheckAuth(c *gin.Context)

func CheckReadonly

func CheckReadonly(c *gin.Context)

func CheckUpdate

func CheckUpdate(showMsg bool)

func CheckoutRepo

func CheckoutRepo(id string)

func ClearWorkspaceHistory

func ClearWorkspaceHistory() (err error)

func Close

func Close(force, setCurrentWorkspace bool, execInstallPkg int) (exitCode int)

Close 退出内核进程.

force:是否不执行同步过程而直接退出

setCurrentWorkspace:是否将当前工作空间放到工作空间列表的最后一个

execInstallPkg:是否执行新版本安装包

0:默认按照设置项 System.DownloadInstallPkg 检查并推送提示
1:不执行新版本安装
2:执行新版本安装

返回值 exitCode:

0:正常退出
1:同步执行失败
2:提示新安装包

当 force 为 true(强制退出)并且 execInstallPkg 为 0(默认检查更新)并且同步失败并且新版本安装版已经准备就绪时,执行新版本安装 https://github.com/siyuan-note/siyuan/issues/10288

func CloseWatchAssets

func CloseWatchAssets()

func CloudChatGPT

func CloudChatGPT(msg string, contextMsgs []string) (ret string, stop bool, err error)

func ContentStat

func ContentStat(content string) (ret *util.BlockStatResult)

func ControlConcurrency

func ControlConcurrency(c *gin.Context)

func CreateBox

func CreateBox(name string) (id string, err error)

func CreateCloudSyncDir

func CreateCloudSyncDir(name string) (err error)

func CreateDailyNote

func CreateDailyNote(boxID string) (p string, existed bool, err error)

func CreateDeck

func CreateDeck(name string) (deck *riff.Deck, err error)

func CreateDocByMd

func CreateDocByMd(boxID, p, title, md string, sorts []string) (tree *parse.Tree, err error)

func CreateWithMarkdown

func CreateWithMarkdown(boxID, hPath, md, parentID, id string) (retID string, err error)

func DeactivateUser

func DeactivateUser() (err error)

func Doc2Heading

func Doc2Heading(srcID, targetID string, after bool) (srcTreeBox, srcTreePath string, err error)

func DocImageAssets

func DocImageAssets(rootID string) (ret []string, err error)

func DocSaveAsTemplate

func DocSaveAsTemplate(id, name string, overwrite bool) (code int, err error)

func DownloadCloudSnapshot

func DownloadCloudSnapshot(tag, id string) (err error)

func DuplicateDoc

func DuplicateDoc(tree *parse.Tree)

func Export2Liandi

func Export2Liandi(id string) (err error)

func ExportAv2CSV

func ExportAv2CSV(avID, blockID string) (zipPath string, err error)

func ExportData

func ExportData() (zipPath string, err error)

func ExportDataInFolder

func ExportDataInFolder(exportFolder string) (name string, err error)

func ExportDocx

func ExportDocx(id, savePath string, removeAssets, merge bool) (err error)

func ExportHTML

func ExportHTML(id, savePath string, pdf, image, keepFold, merge bool) (name, dom string, node *ast.Node)

func ExportMarkdownContent

func ExportMarkdownContent(id string) (hPath, exportedMd string)

func ExportMarkdownHTML

func ExportMarkdownHTML(id, savePath string, docx, merge bool) (name, dom string)

func ExportNotebookSY

func ExportNotebookSY(id string) (zipPath string)

func ExportPandocConvertZip

func ExportPandocConvertZip(id, pandocTo, ext string) (name, zipPath string)

func ExportResources

func ExportResources(resourcePaths []string, mainName string) (exportFilePath string, err error)

func ExportSY

func ExportSY(id string) (name, zipPath string)

func ExportStdMarkdown

func ExportStdMarkdown(id string) string

func ExportSystemLog

func ExportSystemLog() (zipPath string)

func FindReplace

func FindReplace(keyword, replacement string, replaceTypes map[string]bool, ids []string, paths, boxes []string, types map[string]bool, method, orderBy, groupBy int) (err error)

func FlushAssetsTextsJob

func FlushAssetsTextsJob()

func FlushUpdateRefTextRenameDocJob

func FlushUpdateRefTextRenameDocJob()

func FullReindex

func FullReindex()

func FullTextSearchHistory

func FullTextSearchHistory(query, box, op string, typ, page int) (ret []string, pageCount, totalCount int)

func GetAssetAbsPath

func GetAssetAbsPath(relativePath string) (ret string, err error)

func GetAttributeView

func GetAttributeView(avID string) (ret *av.AttributeView)

func GetAttributeViewFilterSort

func GetAttributeViewFilterSort(avID, blockID string) (filters []*av.ViewFilter, sorts []*av.ViewSort)

func GetAttributeViewPrimaryKeyValues

func GetAttributeViewPrimaryKeyValues(avID, keyword string, page, pageSize int) (attributeViewName string, databaseBlockIDs []string, keyValues *av.KeyValues, err error)

func GetBlockAttrs

func GetBlockAttrs(id string) (ret map[string]string)

func GetBlockAttrsWithoutWaitWriting

func GetBlockAttrsWithoutWaitWriting(id string) (ret map[string]string)

func GetBlockDOM

func GetBlockDOM(id string) (ret string)

func GetBlockDefIDsByRefText

func GetBlockDefIDsByRefText(refText string, excludeIDs []string) (ret []string)

func GetBlockIndex

func GetBlockIndex(id string) (ret int)

func GetBlockKramdown

func GetBlockKramdown(id string) (ret string)

func GetBlockRefIDs

func GetBlockRefIDs(id string) (refIDs, refTexts, defIDs []string)

func GetBlockRefIDsByFileAnnotationID

func GetBlockRefIDsByFileAnnotationID(id string) (refIDs, refTexts []string)

func GetBlockRefText

func GetBlockRefText(id string) string

func GetBlocksIndexes

func GetBlocksIndexes(ids []string) (ret map[string]int)

func GetCaptcha

func GetCaptcha(c *gin.Context)

func GetCloudRepoSnapshots

func GetCloudRepoSnapshots(page int) (ret []*dejavu.Log, pageCount, totalCount int, err error)

func GetCloudRepoTagSnapshots

func GetCloudRepoTagSnapshots() (ret []*dejavu.Log, err error)

func GetCloudShorthand

func GetCloudShorthand(id string) (ret map[string]interface{}, err error)

func GetCloudShorthands

func GetCloudShorthands(page int) (result map[string]interface{}, err error)

func GetCloudSpace

func GetCloudSpace() (s *Sync, b *Backup, hSize, hAssetSize, hTotalSize, hExchangeSize, hTrafficUploadSize, hTrafficDownloadSize, hTrafficAPIGet, hTrafficAPIPut string, err error)

func GetDOMText

func GetDOMText(dom string) (ret string)

func GetDecks

func GetDecks() (decks []*riff.Deck)

func GetDoc

func GetDoc(startID, endID, id string, index int, query string, queryTypes map[string]bool, queryMethod, mode int, size int, isBacklink bool) (blockCount int, dom, parentID, parent2ID, rootID, typ string, eof, scroll bool, boxID, docPath string, isBacklinkExpand bool, err error)

func GetDocHistoryContent

func GetDocHistoryContent(historyPath, keyword string) (id, rootID, content string, isLargeDoc bool, err error)

func GetFullHPathByID

func GetFullHPathByID(id string) (hPath string, err error)

func GetHPathByID

func GetHPathByID(id string) (hPath string, err error)

func GetHPathByPath

func GetHPathByPath(boxID, p string) (hPath string, err error)

func GetHPathsByPaths

func GetHPathsByPaths(paths []string) (hPaths []string, err error)

func GetHeadingChildrenDOM

func GetHeadingChildrenDOM(id string) (ret string)

func GetHeadingChildrenIDs

func GetHeadingChildrenIDs(id string) (ret []string)

func GetHistoryDir

func GetHistoryDir(suffix string) (ret string, err error)

func GetIDsByHPath

func GetIDsByHPath(hpath, boxID string) (ret []string, err error)

func GetLocalStorage

func GetLocalStorage() (ret map[string]interface{})

func GetPackageREADME

func GetPackageREADME(repoURL, repoHash, packageType string) (ret string)

func GetParentNextChildID

func GetParentNextChildID(id string) string

func GetRepoFile

func GetRepoFile(fileID string) (ret []byte, p string, err error)

func HTML2Markdown

func HTML2Markdown(htmlStr string) (markdown string, err error)

func HandleSignal

func HandleSignal()

func Heading2Doc

func Heading2Doc(srcHeadingID, targetBoxID, targetPath string) (srcRootBlockID, newTargetPath string, err error)

func HookDesktopUIProcJob

func HookDesktopUIProcJob()

func ImportData

func ImportData(zipPath string) (err error)

func ImportFromLocalPath

func ImportFromLocalPath(boxID, localPath string, toPath string) (err error)

func ImportRepoKey

func ImportRepoKey(base64Key string) (err error)

func ImportSY

func ImportSY(zipPath, boxID, toPath string) (err error)

func IncSync

func IncSync()

func IndexAssetContent

func IndexAssetContent(absPath string)

func IndexEmbedBlockJob

func IndexEmbedBlockJob()

IndexEmbedBlockJob 嵌入块支持搜索 https://github.com/siyuan-note/siyuan/issues/7112

func IndexRefs

func IndexRefs()

func IndexRepo

func IndexRepo(memo string) (err error)

func InitAppearance

func InitAppearance()

func InitBoxes

func InitBoxes()

func InitConf

func InitConf()

func InitRepoKey

func InitRepoKey() (err error)

func InitRepoKeyFromPassphrase

func InitRepoKeyFromPassphrase(passphrase string) (err error)

func InsertLocalAssets

func InsertLocalAssets(id string, assetPaths []string, isUpload bool) (succMap map[string]interface{}, err error)

func InstallBazaarIcon

func InstallBazaarIcon(repoURL, repoHash, iconName string) error

func InstallBazaarPlugin

func InstallBazaarPlugin(repoURL, repoHash, pluginName string) error

func InstallBazaarTemplate

func InstallBazaarTemplate(repoURL, repoHash, templateName string) error

func InstallBazaarTheme

func InstallBazaarTheme(repoURL, repoHash, themeName string, mode int, update bool) error

func InstallBazaarWidget

func InstallBazaarWidget(repoURL, repoHash, widgetName string) error

func InstalledIcons

func InstalledIcons(keyword string) (icons []*bazaar.Icon)

func InstalledPlugins

func InstalledPlugins(frontend, keyword string) (plugins []*bazaar.Plugin)

func InstalledTemplates

func InstalledTemplates(keyword string) (templates []*bazaar.Template)

func InstalledThemes

func InstalledThemes(keyword string) (ret []*bazaar.Theme)

func InstalledWidgets

func InstalledWidgets(keyword string) (widgets []*bazaar.Widget)

func IsBlockFolded

func IsBlockFolded(id string) bool

func IsFoldHeading

func IsFoldHeading(transactions *[]*Transaction) bool

func IsMoveOutlineHeading

func IsMoveOutlineHeading(transactions *[]*Transaction) bool

func IsPaidUser

func IsPaidUser() bool

func IsSubscriber

func IsSubscriber() bool

func IsSyncingFile

func IsSyncingFile(rootID string) (ret bool)

func IsUnfoldHeading

func IsUnfoldHeading(transactions *[]*Transaction) bool

func IsUserGuide

func IsUserGuide(boxID string) bool

func ListItem2Doc

func ListItem2Doc(srcListItemID, targetBoxID, targetPath string) (srcRootBlockID, newTargetPath string, err error)

func LoadFlashcards

func LoadFlashcards()

func LoadSnippets

func LoadSnippets() (ret []*conf.Snippet, err error)

func LoadTreeByBlockID

func LoadTreeByBlockID(id string) (ret *parse.Tree, err error)

func LoadTreeByBlockIDWithReindex

func LoadTreeByBlockIDWithReindex(id string) (ret *parse.Tree, err error)

func LoadUploadToken

func LoadUploadToken() (err error)

func Login

func Login(userName, password, captcha string, cloudRegion int) (ret *gulu.Result)

func Login2fa

func Login2fa(token, code string) (map[string]interface{}, error)

func LoginAuth

func LoginAuth(c *gin.Context)

func LogoutAuth

func LogoutAuth(c *gin.Context)

func LogoutUser

func LogoutUser()

func MissingAssets

func MissingAssets() (ret []string)

func Mount

func Mount(boxID string) (alreadyMount bool, err error)

func MoveDocs

func MoveDocs(fromPaths []string, toBoxID, toPath string, callback interface{}) (err error)

func NetAssets2LocalAssets

func NetAssets2LocalAssets(rootID string) (err error)

func NetImg2LocalAssets

func NetImg2LocalAssets(rootID, originalURL string) (err error)

func NewLute

func NewLute() (ret *lute.Lute)

func OCRAssetsJob

func OCRAssetsJob()

func OpenRepoSnapshotDoc

func OpenRepoSnapshotDoc(fileID string) (content string, isProtyleDoc bool, updated int64, err error)

func PerformTransactions

func PerformTransactions(transactions *[]*Transaction)

func ProcessPDF

func ProcessPDF(id, p string, merge, removeAssets, watermark bool) (err error)

func PurgeCloud

func PurgeCloud() (err error)

func PurgeRepo

func PurgeRepo() (err error)

func Recover

func Recover(c *gin.Context)
func RefreshBacklink(id string)

func RefreshCheckJob

func RefreshCheckJob()

func RefreshUser

func RefreshUser(token string)

func ReindexAssetContent

func ReindexAssetContent()

func ReindexHistory

func ReindexHistory()

func RemoveAttributeViewBlock

func RemoveAttributeViewBlock(srcIDs []string, avID string) (err error)

func RemoveAttributeViewKey

func RemoveAttributeViewKey(avID, keyID string) (err error)

func RemoveBookmark

func RemoveBookmark(bookmark string) (err error)

func RemoveBox

func RemoveBox(boxID string) (err error)

func RemoveCloudRepoTag

func RemoveCloudRepoTag(tag string) (err error)

func RemoveCloudShorthands

func RemoveCloudShorthands(ids []string) (err error)

func RemoveCloudSyncDir

func RemoveCloudSyncDir(name string) (err error)

func RemoveCriterion

func RemoveCriterion(name string) (err error)

func RemoveDeck

func RemoveDeck(deckID string) (err error)

func RemoveDoc

func RemoveDoc(boxID, p string)

func RemoveDocs

func RemoveDocs(paths []string)

func RemoveIndexAssetContent

func RemoveIndexAssetContent(absPath string)

func RemoveIndexes

func RemoveIndexes(paths []string)

func RemoveLocalStorageVals

func RemoveLocalStorageVals(keys []string) (err error)

func RemoveRecentDoc

func RemoveRecentDoc(ids []string)

func RemoveSnippet

func RemoveSnippet(id string) (ret *conf.Snippet, err error)

func RemoveTag

func RemoveTag(label string) (err error)

func RemoveTagSnapshot

func RemoveTagSnapshot(tag string) (err error)

func RemoveTemplate

func RemoveTemplate(p string) (err error)

func RemoveUnusedAsset

func RemoveUnusedAsset(p string) (ret string)

func RemoveUnusedAssets

func RemoveUnusedAssets() (ret []string)

func RenameAsset

func RenameAsset(oldPath, newName string) (err error)

func RenameBookmark

func RenameBookmark(oldBookmark, newBookmark string) (err error)

func RenameBox

func RenameBox(boxID, name string) (err error)

func RenameDeck

func RenameDeck(deckID, name string) (err error)

func RenameDoc

func RenameDoc(boxID, p, title string) (err error)

func RenameTag

func RenameTag(oldLabel, newLabel string) (err error)

func RenderAttributeView

func RenderAttributeView(avID, viewID, query string, page, pageSize int) (viewable av.Viewable, attrView *av.AttributeView, err error)

func RenderGoTemplate

func RenderGoTemplate(templateContent string) (ret string, err error)

func RenderHistoryAttributeView

func RenderHistoryAttributeView(avID, created string) (viewable av.Viewable, attrView *av.AttributeView, err error)

func RenderRepoSnapshotAttributeView

func RenderRepoSnapshotAttributeView(indexID, avID string) (viewable av.Viewable, attrView *av.AttributeView, err error)

func RenderTemplate

func RenderTemplate(p, id string, preview bool) (tree *parse.Tree, dom string, err error)

func ResetBlockAttrs

func ResetBlockAttrs(id string, nameValues map[string]string) (err error)

func ResetFlashcards

func ResetFlashcards(typ, id, deckID string, blockIDs []string)

func ResetRepo

func ResetRepo() (err error)

func ResetVirtualBlockRefCache

func ResetVirtualBlockRefCache()

func ReviewFlashcard

func ReviewFlashcard(deckID, cardID string, rating riff.Rating, reviewedCardIDs []string) (err error)

func RollbackAssetsHistory

func RollbackAssetsHistory(historyPath string) (err error)

func RollbackDocHistory

func RollbackDocHistory(boxID, historyPath string) (err error)

func RollbackNotebookHistory

func RollbackNotebookHistory(historyPath string) (err error)

func SQLTemplateFuncs

func SQLTemplateFuncs(templateFuncMap *template.FuncMap)

func SearchAssetsByName

func SearchAssetsByName(keyword string, exts []string) (ret []*cache.Asset)

func SearchAttributeViewNonRelationKey

func SearchAttributeViewNonRelationKey(avID, keyword string) (ret []*av.Key)

func SearchAttributeViewRelationKey

func SearchAttributeViewRelationKey(avID, keyword string) (ret []*av.Key)

func SearchDocsByKeyword

func SearchDocsByKeyword(keyword string, flashcard bool) (ret []map[string]string)

func SearchTags

func SearchTags(keyword string) (ret []string)

func SetBlockAttrs

func SetBlockAttrs(id string, nameValues map[string]string) (err error)

func SetBlockReminder

func SetBlockReminder(id string, timed string) (err error)

func SetBoxIcon

func SetBoxIcon(boxID, icon string)

func SetCloudBlockReminder

func SetCloudBlockReminder(id, data string, timed int64) (err error)

func SetCloudSyncDir

func SetCloudSyncDir(name string)

func SetCriterion

func SetCriterion(criterion *Criterion) (err error)

func SetDatabaseBlockView

func SetDatabaseBlockView(blockID, viewID string) (err error)

func SetFlashcardsDueTime

func SetFlashcardsDueTime(cardDues []*SetFlashcardDueTime) (err error)

func SetLocalStorage

func SetLocalStorage(val interface{}) (err error)

func SetLocalStorageVal

func SetLocalStorageVal(key string, val interface{}) (err error)

func SetRecentDoc

func SetRecentDoc(doc *RecentDoc) (err error)

func SetRecentDocByTree

func SetRecentDocByTree(tree *parse.Tree)

func SetSnippet

func SetSnippet(snippets []*conf.Snippet) (err error)

func SetSyncEnable

func SetSyncEnable(b bool)

func SetSyncGenerateConflictDoc

func SetSyncGenerateConflictDoc(b bool)

func SetSyncMode

func SetSyncMode(mode int)

func SetSyncPerception

func SetSyncPerception(b bool)

func SetSyncProvider

func SetSyncProvider(provider int) (err error)

func SetSyncProviderS3

func SetSyncProviderS3(s3 *conf.S3) (err error)

func SetSyncProviderWebDAV

func SetSyncProviderWebDAV(webdav *conf.WebDAV) (err error)

func SkipReviewFlashcard

func SkipReviewFlashcard(deckID, cardID string) (err error)

func SortAttributeViewKey

func SortAttributeViewKey(avID, blockID, keyID, previousKeyID string) (err error)

func StartFreeTrial

func StartFreeTrial() (err error)

func StatJob

func StatJob()

func StatTree

func StatTree(id string) (ret *util.BlockStatResult)

func SwapBlockRef

func SwapBlockRef(refID, defID string, includeChildren bool) (err error)

func SyncData

func SyncData(byHand bool)

func SyncDataDownload

func SyncDataDownload()

func SyncDataJob

func SyncDataJob()

func SyncDataUpload

func SyncDataUpload()

func TagSnapshot

func TagSnapshot(id, name string) (err error)

func Timing

func Timing(c *gin.Context)

func TransferBlockRef

func TransferBlockRef(fromID, toID string, refIDs []string) (err error)

func UninstallBazaarIcon

func UninstallBazaarIcon(iconName string) error

func UninstallBazaarPlugin

func UninstallBazaarPlugin(pluginName, frontend string) error

func UninstallBazaarTemplate

func UninstallBazaarTemplate(templateName string) error

func UninstallBazaarTheme

func UninstallBazaarTheme(themeName string) error

func UninstallBazaarWidget

func UninstallBazaarWidget(widgetName string) error

func Unmount

func Unmount(boxID string)

func UnusedAssets

func UnusedAssets() (ret []string)

func UpdateAttributeViewCell

func UpdateAttributeViewCell(tx *Transaction, avID, keyID, rowID, cellID string, valueData interface{}) (err error)

func UpdateEmbedBlock

func UpdateEmbedBlock(id, content string) (err error)

func UpdatedPackages

func UpdatedPackages(frontend string) (plugins []*bazaar.Plugin, widgets []*bazaar.Widget, icons []*bazaar.Icon, themes []*bazaar.Theme, templates []*bazaar.Template)

func Upload

func Upload(c *gin.Context)

func UploadAssets2Cloud

func UploadAssets2Cloud(rootID string) (count int, err error)

func UploadCloudSnapshot

func UploadCloudSnapshot(tag, id string) (err error)

func UpsertIndexes

func UpsertIndexes(paths []string)

func UseActivationcode

func UseActivationcode(code string) (err error)

func WaitForWritingFiles

func WaitForWritingFiles()

func WatchAssets

func WatchAssets()

Types

type Announcement

type Announcement struct {
	Id     string `json:"id"`
	Title  string `json:"title"`
	URL    string `json:"url"`
	Region int    `json:"region"`
}

func GetAnnouncements

func GetAnnouncements() (ret []*Announcement)

type AppConf

type AppConf struct {
	LogLevel       string           `json:"logLevel"`       // 日志级别:Off, Trace, Debug, Info, Warn, Error, Fatal
	Appearance     *conf.Appearance `json:"appearance"`     // 外观
	Langs          []*conf.Lang     `json:"langs"`          // 界面语言列表
	Lang           string           `json:"lang"`           // 选择的界面语言,同 Appearance.Lang
	FileTree       *conf.FileTree   `json:"fileTree"`       // 文档面板
	Tag            *conf.Tag        `json:"tag"`            // 标签面板
	Editor         *conf.Editor     `json:"editor"`         // 编辑器配置
	Export         *conf.Export     `json:"export"`         // 导出配置
	Graph          *conf.Graph      `json:"graph"`          // 关系图配置
	UILayout       *conf.UILayout   `json:"uiLayout"`       // 界面布局。不要直接使用,使用 GetUILayout() 和 SetUILayout() 方法
	UserData       string           `json:"userData"`       // 社区用户信息,对 User 加密存储
	User           *conf.User       `json:"-"`              // 社区用户内存结构,不持久化。不要直接使用,使用 GetUser() 和 SetUser() 方法
	Account        *conf.Account    `json:"account"`        // 帐号配置
	ReadOnly       bool             `json:"readonly"`       // 是否是以只读模式运行
	LocalIPs       []string         `json:"localIPs"`       // 本地 IP 列表
	AccessAuthCode string           `json:"accessAuthCode"` // 访问授权码
	System         *conf.System     `json:"system"`         // 系统配置
	Keymap         *conf.Keymap     `json:"keymap"`         // 快捷键配置
	Sync           *conf.Sync       `json:"sync"`           // 同步配置
	Search         *conf.Search     `json:"search"`         // 搜索配置
	Flashcard      *conf.Flashcard  `json:"flashcard"`      // 闪卡配置
	AI             *conf.AI         `json:"ai"`             // 人工智能配置
	Bazaar         *conf.Bazaar     `json:"bazaar"`         // 集市配置
	Stat           *conf.Stat       `json:"stat"`           // 统计
	Api            *conf.API        `json:"api"`            // API
	Repo           *conf.Repo       `json:"repo"`           // 数据仓库
	OpenHelp       bool             `json:"openHelp"`       // 启动后是否需要打开用户指南
	ShowChangelog  bool             `json:"showChangelog"`  // 是否显示版本更新日志
	CloudRegion    int              `json:"cloudRegion"`    // 云端区域,0:中国大陆,1:北美
	Snippet        *conf.Snpt       `json:"snippet"`        // 代码片段
	State          int              `json:"state"`          // 运行状态,0:已经正常退出,1:运行中
	// contains filtered or unexported fields
}

AppConf 维护应用元数据,保存在 ~/.siyuan/conf.json。

var Conf *AppConf

func GetMaskedConf

func GetMaskedConf() (ret *AppConf, err error)

func (*AppConf) Box

func (conf *AppConf) Box(boxID string) *Box

func (*AppConf) BoxNames

func (conf *AppConf) BoxNames(boxIDs []string) (ret map[string]string)

func (*AppConf) Close

func (conf *AppConf) Close()

func (*AppConf) GetBox

func (conf *AppConf) GetBox(boxID string) *Box

func (*AppConf) GetBoxes

func (conf *AppConf) GetBoxes() (ret []*Box)

func (*AppConf) GetClosedBoxes

func (conf *AppConf) GetClosedBoxes() (ret []*Box)

func (*AppConf) GetOpenedBoxes

func (conf *AppConf) GetOpenedBoxes() (ret []*Box)

func (*AppConf) GetUILayout

func (conf *AppConf) GetUILayout() *conf.UILayout

func (*AppConf) GetUser

func (conf *AppConf) GetUser() *conf.User

func (*AppConf) Language

func (conf *AppConf) Language(num int) (ret string)

func (*AppConf) Save

func (conf *AppConf) Save()

func (*AppConf) SetUILayout

func (conf *AppConf) SetUILayout(uiLayout *conf.UILayout)

func (*AppConf) SetUser

func (conf *AppConf) SetUser(user *conf.User)

type AssetContent

type AssetContent struct {
	ID      string `json:"id"`
	Name    string `json:"name"`
	Ext     string `json:"ext"`
	Path    string `json:"path"`
	Size    int64  `json:"size"`
	HSize   string `json:"hSize"`
	Updated int64  `json:"updated"`
	Content string `json:"content"`
}

func FullTextSearchAssetContent

func FullTextSearchAssetContent(query string, types map[string]bool, method, orderBy, page, pageSize int) (ret []*AssetContent, matchedAssetCount, pageCount int)

FullTextSearchAssetContent 搜索资源文件内容。

method:0:关键字,1:查询语法,2:SQL,3:正则表达式 orderBy: 0:按相关度降序,1:按相关度升序,2:按更新时间升序,3:按更新时间降序

func GetAssetContent

func GetAssetContent(id, query string, queryMethod int) (ret *AssetContent)

type AssetParseResult

type AssetParseResult struct {
	Path    string
	Size    int64
	Updated int64
	Content string
}

type AssetParser

type AssetParser interface {
	Parse(absPath string) *AssetParseResult
}

type AssetsSearcher

type AssetsSearcher struct {
	// contains filtered or unexported fields
}

func NewAssetsSearcher

func NewAssetsSearcher() *AssetsSearcher

func (*AssetsSearcher) FullIndex

func (searcher *AssetsSearcher) FullIndex()

func (*AssetsSearcher) GetParser

func (searcher *AssetsSearcher) GetParser(ext string) AssetParser

type AttrView

type AttrView struct {
	ID   string `json:"id"`
	Name string `json:"name"`
}
type Backlink struct {
	DOM        string       `json:"dom"`
	BlockPaths []*BlockPath `json:"blockPaths"`
	Expand     bool         `json:"expand"`
}

func GetBacklinkDoc

func GetBacklinkDoc(defID, refTreeID, keyword string) (ret []*Backlink)

func GetBackmentionDoc

func GetBackmentionDoc(defID, refTreeID, keyword string) (ret []*Backlink)

type Backup

type Backup struct {
	Size    int64  `json:"size"`
	HSize   string `json:"hSize"`
	Updated string `json:"updated"`
	SaveDir string `json:"saveDir"` // 本地备份数据存放目录路径
}

type Block

type Block struct {
	Box      string            `json:"box"`
	Path     string            `json:"path"`
	HPath    string            `json:"hPath"`
	ID       string            `json:"id"`
	RootID   string            `json:"rootID"`
	ParentID string            `json:"parentID"`
	Name     string            `json:"name"`
	Alias    string            `json:"alias"`
	Memo     string            `json:"memo"`
	Tag      string            `json:"tag"`
	Content  string            `json:"content"`
	FContent string            `json:"fcontent"`
	Markdown string            `json:"markdown"`
	Folded   bool              `json:"folded"`
	Type     string            `json:"type"`
	SubType  string            `json:"subType"`
	RefText  string            `json:"refText"`
	Defs     []*Block          `json:"-"`    // 当前块引用了这些块,避免序列化 JSON 时产生循环引用
	Refs     []*Block          `json:"refs"` // 当前块被这些块引用
	DefID    string            `json:"defID"`
	DefPath  string            `json:"defPath"`
	IAL      map[string]string `json:"ial"`
	Children []*Block          `json:"children"`
	Depth    int               `json:"depth"`
	Count    int               `json:"count"`
	Sort     int               `json:"sort"`
	Created  string            `json:"created"`
	Updated  string            `json:"updated"`

	RiffCardID string    `json:"riffCardID"`
	RiffCard   *RiffCard `json:"riffCard"`
}

Block 描述了内容块。

func FullTextSearchBlock

func FullTextSearchBlock(query string, boxes, paths []string, types map[string]bool, method, orderBy, groupBy, page, pageSize int) (ret []*Block, matchedBlockCount, matchedRootCount, pageCount int)

FullTextSearchBlock 搜索内容块。

method:0:关键字,1:查询语法,2:SQL,3:正则表达式 orderBy: 0:按块类型(默认),1:按创建时间升序,2:按创建时间降序,3:按更新时间升序,4:按更新时间降序,5:按内容顺序(仅在按文档分组时),6:按相关度升序,7:按相关度降序 groupBy:0:不分组,1:按文档分组

func GetBlock

func GetBlock(id string, tree *parse.Tree) (ret *Block, err error)

func GetDeckFlashcards

func GetDeckFlashcards(deckID string, page, pageSize int) (blocks []*Block, total, pageCount int)

func GetFlashcardsByBlockIDs

func GetFlashcardsByBlockIDs(blockIDs []string) (ret []*Block)

func GetNotebookFlashcards

func GetNotebookFlashcards(boxID string, page, pageSize int) (blocks []*Block, total, pageCount int)

func GetTreeFlashcards

func GetTreeFlashcards(rootID string, page, pageSize int) (blocks []*Block, total, pageCount int)

func ListInvalidBlockRefs

func ListInvalidBlockRefs(page, pageSize int) (ret []*Block, matchedBlockCount, matchedRootCount, pageCount int)

func RecentUpdatedBlocks

func RecentUpdatedBlocks() (ret []*Block)

func SearchRefBlock

func SearchRefBlock(id, rootID, keyword string, beforeLen int, isSquareBrackets bool) (ret []*Block, newDoc bool)

func SearchTemplate

func SearchTemplate(keyword string) (ret []*Block)

func SearchWidget

func SearchWidget(keyword string) (ret []*Block)

func (*Block) IsContainerBlock

func (block *Block) IsContainerBlock() bool

type BlockAttributeViewKeys

type BlockAttributeViewKeys struct {
	AvID      string          `json:"avID"`
	AvName    string          `json:"avName"`
	BlockIDs  []string        `json:"blockIDs"`
	KeyValues []*av.KeyValues `json:"keyValues"`
}

func GetBlockAttributeViewKeys

func GetBlockAttributeViewKeys(blockID string) (ret []*BlockAttributeViewKeys)

type BlockInfo

type BlockInfo struct {
	ID           string            `json:"id"`
	RootID       string            `json:"rootID"`
	Name         string            `json:"name"`
	RefCount     int               `json:"refCount"`
	SubFileCount int               `json:"subFileCount"`
	RefIDs       []string          `json:"refIDs"`
	IAL          map[string]string `json:"ial"`
	Icon         string            `json:"icon"`
	AttrViews    []*AttrView       `json:"attrViews"`
}

func GetDocInfo

func GetDocInfo(blockID string) (ret *BlockInfo)

type BlockPath

type BlockPath struct {
	ID       string       `json:"id"`
	Name     string       `json:"name"`
	Type     string       `json:"type"`
	SubType  string       `json:"subType"`
	Children []*BlockPath `json:"children"`
}

func BuildBlockBreadcrumb

func BuildBlockBreadcrumb(id string, excludeTypes []string) (ret []*BlockPath, err error)

type Bookmark

type Bookmark struct {
	Name   BookmarkLabel `json:"name"`
	Blocks []*Block      `json:"blocks"`
	Type   string        `json:"type"` // "bookmark"
	Depth  int           `json:"depth"`
	Count  int           `json:"count"`
}

type BookmarkBlocks

type BookmarkBlocks []*Block

type BookmarkLabel

type BookmarkLabel string

type Bookmarks

type Bookmarks []*Bookmark

func BuildBookmark

func BuildBookmark() (ret *Bookmarks)

func (Bookmarks) Len

func (s Bookmarks) Len() int

func (Bookmarks) Less

func (s Bookmarks) Less(i, j int) bool

func (Bookmarks) Swap

func (s Bookmarks) Swap(i, j int)

type Box

type Box struct {
	ID       string `json:"id"`
	Name     string `json:"name"`
	Icon     string `json:"icon"`
	Sort     int    `json:"sort"`
	SortMode int    `json:"sortMode"`
	Closed   bool   `json:"closed"`

	NewFlashcardCount int `json:"newFlashcardCount"`
	DueFlashcardCount int `json:"dueFlashcardCount"`
	FlashcardCount    int `json:"flashcardCount"`
	// contains filtered or unexported fields
}

Box 笔记本。

func GetFlashcardNotebooks

func GetFlashcardNotebooks() (ret []*Box)

func ListNotebooks

func ListNotebooks() (ret []*Box, err error)

func (*Box) Exist

func (box *Box) Exist(p string) bool

func (*Box) GetConf

func (box *Box) GetConf() (ret *conf.BoxConf)

func (*Box) Index

func (box *Box) Index()

func (*Box) ListFiles

func (box *Box) ListFiles(path string) (ret []*FileInfo)

func (*Box) Ls

func (box *Box) Ls(p string) (ret []*FileInfo, totals int, err error)

func (*Box) Mkdir

func (box *Box) Mkdir(path string) error

func (*Box) MkdirAll

func (box *Box) MkdirAll(path string) error

func (*Box) Move

func (box *Box) Move(oldPath, newPath string) error

func (*Box) Remove

func (box *Box) Remove(path string) error

func (*Box) SaveConf

func (box *Box) SaveConf(conf *conf.BoxConf)

func (*Box) Stat

func (box *Box) Stat(p string) (ret *FileInfo)

func (*Box) Unindex

func (box *Box) Unindex()

func (*Box) UpdateHistoryGenerated

func (box *Box) UpdateHistoryGenerated()

type ChildBlock

type ChildBlock struct {
	ID      string `json:"id"`
	Type    string `json:"type"`
	SubType string `json:"subType,omitempty"`
}

func GetChildBlocks

func GetChildBlocks(id string) (ret []*ChildBlock)

func GetTailChildBlocks

func GetTailChildBlocks(id string, n int) (ret []*ChildBlock)

type CloudGPT

type CloudGPT struct {
}

type Criterion

type Criterion struct {
	Name         string                 `json:"name"`
	Sort         int                    `json:"sort"`       //  0:按块类型(默认),1:按创建时间升序,2:按创建时间降序,3:按更新时间升序,4:按更新时间降序,5:按内容顺序(仅在按文档分组时)
	Group        int                    `json:"group"`      // 0:不分组,1:按文档分组
	HasReplace   bool                   `json:"hasReplace"` // 是否有替换
	Method       int                    `json:"method"`     //  0:文本,1:查询语法,2:SQL,3:正则表达式
	HPath        string                 `json:"hPath"`
	IDPath       []string               `json:"idPath"`
	K            string                 `json:"k"`            // 搜索关键字
	R            string                 `json:"r"`            // 替换关键字
	Types        *CriterionTypes        `json:"types"`        // 类型过滤选项
	ReplaceTypes *CriterionReplaceTypes `json:"replaceTypes"` // 替换类型过滤选项
}

func GetCriteria

func GetCriteria() (ret []*Criterion)

type CriterionReplaceTypes

type CriterionReplaceTypes struct {
	Text       bool `json:"text"`
	ImgText    bool `json:"imgText"`
	ImgTitle   bool `json:"imgTitle"`
	ImgSrc     bool `json:"imgSrc"`
	AText      bool `json:"aText"`
	ATitle     bool `json:"aTitle"`
	AHref      bool `json:"aHref"`
	Code       bool `json:"code"`
	Em         bool `json:"em"`
	Strong     bool `json:"strong"`
	InlineMath bool `json:"inlineMath"`
	InlineMemo bool `json:"inlineMemo"`
	Kbd        bool `json:"kbd"`
	Mark       bool `json:"mark"`
	S          bool `json:"s"`
	Sub        bool `json:"sub"`
	Sup        bool `json:"sup"`
	Tag        bool `json:"tag"`
	U          bool `json:"u"`
	DocTitle   bool `json:"docTitle"`
	CodeBlock  bool `json:"codeBlock"`
	MathBlock  bool `json:"mathBlock"`
	HtmlBlock  bool `json:"htmlBlock"`
}

type CriterionTypes

type CriterionTypes struct {
	MathBlock     bool `json:"mathBlock"`
	Table         bool `json:"table"`
	Blockquote    bool `json:"blockquote"`
	SuperBlock    bool `json:"superBlock"`
	Paragraph     bool `json:"paragraph"`
	Document      bool `json:"document"`
	Heading       bool `json:"heading"`
	List          bool `json:"list"`
	ListItem      bool `json:"listItem"`
	CodeBlock     bool `json:"codeBlock"`
	HtmlBlock     bool `json:"htmlBlock"`
	EmbedBlock    bool `json:"embedBlock"`
	DatabaseBlock bool `json:"databaseBlock"`
	AudioBlock    bool `json:"audioBlock"`
	VideoBlock    bool `json:"videoBlock"`
	IFrameBlock   bool `json:"iframeBlock"`
	WidgetBlock   bool `json:"widgetBlock"`
}

type DiffFile

type DiffFile struct {
	FileID  string `json:"fileID"`
	Title   string `json:"title"`
	Path    string `json:"path"`
	HSize   string `json:"hSize"`
	Updated int64  `json:"updated"`
}

type DiffIndex

type DiffIndex struct {
	ID      string `json:"id"`
	Created int64  `json:"created"`
}

type DocxAssetParser

type DocxAssetParser struct {
}

func (*DocxAssetParser) Parse

func (parser *DocxAssetParser) Parse(absPath string) (ret *AssetParseResult)

type EmbedBlock

type EmbedBlock struct {
	Block      *Block       `json:"block"`
	BlockPaths []*BlockPath `json:"blockPaths"`
}

func GetEmbedBlock

func GetEmbedBlock(embedBlockID string, includeIDs []string, headingMode int, breadcrumb bool) (ret []*EmbedBlock)

func SearchEmbedBlock

func SearchEmbedBlock(embedBlockID, stmt string, excludeIDs []string, headingMode int, breadcrumb bool) (ret []*EmbedBlock)

type EpubAssetParser

type EpubAssetParser struct {
}

func (*EpubAssetParser) Parse

func (parser *EpubAssetParser) Parse(absPath string) (ret *AssetParseResult)

type File

type File struct {
	Path         string `json:"path"`
	Name         string `json:"name"` // 标题,即 ial["title"]
	Icon         string `json:"icon"`
	Name1        string `json:"name1"` // 命名,即 ial["name"]
	Alias        string `json:"alias"`
	Memo         string `json:"memo"`
	Bookmark     string `json:"bookmark"`
	ID           string `json:"id"`
	Count        int    `json:"count"`
	Size         uint64 `json:"size"`
	HSize        string `json:"hSize"`
	Mtime        int64  `json:"mtime"`
	CTime        int64  `json:"ctime"`
	HMtime       string `json:"hMtime"`
	HCtime       string `json:"hCtime"`
	Sort         int    `json:"sort"`
	SubFileCount int    `json:"subFileCount"`
	Hidden       bool   `json:"hidden"`

	NewFlashcardCount int `json:"newFlashcardCount"`
	DueFlashcardCount int `json:"dueFlashcardCount"`
	FlashcardCount    int `json:"flashcardCount"`
}

func ListDocTree

func ListDocTree(boxID, listPath string, sortMode int, flashcard, showHidden bool, maxListCount int) (ret []*File, totals int, err error)

type FileInfo

type FileInfo struct {
	// contains filtered or unexported fields
}

type Flashcard

type Flashcard struct {
	DeckID     string                 `json:"deckID"`
	CardID     string                 `json:"cardID"`
	BlockID    string                 `json:"blockID"`
	Lapses     int                    `json:"lapses"`
	Reps       int                    `json:"reps"`
	State      riff.State             `json:"state"`
	LastReview int64                  `json:"lastReview"`
	NextDues   map[riff.Rating]string `json:"nextDues"`
}

func GetDueFlashcards

func GetDueFlashcards(deckID string, reviewedCardIDs []string) (ret []*Flashcard, unreviewedCount, unreviewedNewCardCount, unreviewedOldCardCount int, err error)

func GetNotebookDueFlashcards

func GetNotebookDueFlashcards(boxID string, reviewedCardIDs []string) (ret []*Flashcard, unreviewedCount, unreviewedNewCardCount, unreviewedOldCardCount int, err error)

func GetTreeDueFlashcards

func GetTreeDueFlashcards(rootID string, reviewedCardIDs []string) (ret []*Flashcard, unreviewedCount, unreviewedNewCardCount, unreviewedOldCardCount int, err error)

type GPT

type GPT interface {
	// contains filtered or unexported methods
}

type GraphArrows

type GraphArrows struct {
	To *GraphArrowsTo `json:"to"`
}

type GraphArrowsTo

type GraphArrowsTo struct {
	Enabled bool `json:"enabled"`
}
type GraphLink struct {
	From   string       `json:"from"`
	To     string       `json:"to"`
	Ref    bool         `json:"ref"`
	Arrows *GraphArrows `json:"arrows"`
}

type GraphNode

type GraphNode struct {
	ID    string  `json:"id"`
	Box   string  `json:"box"`
	Path  string  `json:"path"`
	Size  float64 `json:"size"`
	Title string  `json:"title,omitempty"`
	Label string  `json:"label"`
	Type  string  `json:"type"`
	Refs  int     `json:"refs"`
	Defs  int     `json:"defs"`
}

type History

type History struct {
	HCreated string         `json:"hCreated"`
	Items    []*HistoryItem `json:"items"`
}

func GetNotebookHistory

func GetNotebookHistory() (ret []*History, err error)

type HistoryItem

type HistoryItem struct {
	Title    string `json:"title"`
	Path     string `json:"path"`
	Op       string `json:"op"`
	Notebook string `json:"notebook"` // 仅用于文档历史
}

func FullTextSearchHistoryItems

func FullTextSearchHistoryItems(created, query, box, op string, typ int) (ret []*HistoryItem)

type LeftRightDiff

type LeftRightDiff struct {
	LeftIndex    *DiffIndex  `json:"leftIndex"`
	RightIndex   *DiffIndex  `json:"rightIndex"`
	AddsLeft     []*DiffFile `json:"addsLeft"`
	UpdatesLeft  []*DiffFile `json:"updatesLeft"`
	UpdatesRight []*DiffFile `json:"updatesRight"`
	RemovesRight []*DiffFile `json:"removesRight"`
}

func DiffRepoSnapshots

func DiffRepoSnapshots(left, right string) (ret *LeftRightDiff, err error)

type OnlineKernel

type OnlineKernel struct {
	ID       string `json:"id"`
	Hostname string `json:"hostname"`
	OS       string `json:"os"`
	Ver      string `json:"ver"`
}

func GetOnlineKernels

func GetOnlineKernels() (ret []*OnlineKernel)

type OpenAIGPT

type OpenAIGPT struct {
	// contains filtered or unexported fields
}

type Operation

type Operation struct {
	Action     string      `json:"action"`
	Data       interface{} `json:"data"`
	ID         string      `json:"id"`
	ParentID   string      `json:"parentID"`
	PreviousID string      `json:"previousID"`
	NextID     string      `json:"nextID"`
	RetData    interface{} `json:"retData"`
	BlockIDs   []string    `json:"blockIDs"`
	BlockID    string      `json:"blockID"`

	DeckID string `json:"deckID"` // 用于添加/删除闪卡

	AvID                string                   `json:"avID"`              // 属性视图 ID
	SrcIDs              []string                 `json:"srcIDs"`            // 用于从属性视图中删除行
	Srcs                []map[string]interface{} `json:"srcs"`              // 用于添加属性视图行(包括绑定块){id, content, isDetached}
	IsDetached          bool                     `json:"isDetached"`        // 用于标识是否未绑定块,仅存在于属性视图中
	IgnoreFillFilterVal bool                     `json:"ignoreFillFilter"`  // 用于标识是否忽略填充筛选值
	Name                string                   `json:"name"`              // 属性视图列名
	Typ                 string                   `json:"type"`              // 属性视图列类型
	Format              string                   `json:"format"`            // 属性视图列格式化
	KeyID               string                   `json:"keyID"`             // 属性视列 ID
	RowID               string                   `json:"rowID"`             // 属性视图行 ID
	IsTwoWay            bool                     `json:"isTwoWay"`          // 属性视图关联列是否是双向关系
	BackRelationKeyID   string                   `json:"backRelationKeyID"` // 属性视图关联列回链关联列的 ID
}

type Path

type Path struct {
	ID       string   `json:"id"`                 // 块 ID
	Box      string   `json:"box"`                // 块 Box
	Name     string   `json:"name"`               // 当前路径
	HPath    string   `json:"hPath"`              // 人类可读路径
	Type     string   `json:"type"`               // "path"
	NodeType string   `json:"nodeType"`           // 节点类型
	SubType  string   `json:"subType"`            // 节点子类型
	Blocks   []*Block `json:"blocks,omitempty"`   // 子块节点
	Children []*Path  `json:"children,omitempty"` // 子路径节点
	Depth    int      `json:"depth"`              // 层级深度
	Count    int      `json:"count"`              // 子块计数

	Updated string `json:"updated"` // 更新时间
	Created string `json:"created"` // 创建时间
}
func GetBacklink(id, keyword, mentionKeyword string, beforeLen int) (boxID string, linkPaths, mentionPaths []*Path, linkRefsCount, mentionsCount int)

func GetBacklink2

func GetBacklink2(id, keyword, mentionKeyword string, sortMode, mentionSortMode int) (boxID string, backlinks, backmentions []*Path, linkRefsCount, mentionsCount int)

func Outline

func Outline(rootID string) (ret []*Path, err error)

func Preview

func Preview(id string) (retStdHTML string, retOutline []*Path)

type PdfAssetParser

type PdfAssetParser struct {
}

PdfAssetParser parser factory product

func (*PdfAssetParser) Parse

func (parser *PdfAssetParser) Parse(absPath string) (ret *AssetParseResult)

Parse will parse a PDF document using PDFium webassembly module using a worker pool

type Petal

type Petal struct {
	Name         string `json:"name"`         // Plugin name
	DisplayName  string `json:"displayName"`  // Plugin display name
	Enabled      bool   `json:"enabled"`      // Whether enabled
	Incompatible bool   `json:"incompatible"` // Whether incompatible

	JS   string                 `json:"js"`   // JS code
	CSS  string                 `json:"css"`  // CSS code
	I18n map[string]interface{} `json:"i18n"` // i18n text
}

Petal represents a plugin's management status.

func LoadPetals

func LoadPetals(frontend string) (ret []*Petal)

func SetPetalEnabled

func SetPetalEnabled(name string, enabled bool, frontend string) (ret *Petal, err error)

type PptxAssetParser

type PptxAssetParser struct {
}

func (*PptxAssetParser) Parse

func (parser *PptxAssetParser) Parse(absPath string) (ret *AssetParseResult)

type RecentDoc

type RecentDoc struct {
	RootID string `json:"rootID"`
	Icon   string `json:"icon"`
	Title  string `json:"title"`
}

func GetRecentDocs

func GetRecentDocs() (ret []*RecentDoc, err error)

type RiffCard

type RiffCard struct {
	Due        time.Time  `json:"due"`
	Reps       uint64     `json:"reps"`
	Lapses     uint64     `json:"lapses"`
	State      fsrs.State `json:"state"`
	LastReview time.Time  `json:"lastReview"`
}

type SearchAttributeViewResult

type SearchAttributeViewResult struct {
	AvID    string `json:"avID"`
	AvName  string `json:"avName"`
	BlockID string `json:"blockID"`
	HPath   string `json:"hPath"`
}

func SearchAttributeView

func SearchAttributeView(keyword string, excludeAvIDs []string) (ret []*SearchAttributeViewResult)

type SetFlashcardDueTime

type SetFlashcardDueTime struct {
	ID  string `json:"id"`  // 卡片 ID
	Due string `json:"due"` // 下次复习时间,格式为 YYYYMMDDHHmmss
}

type Snapshot

type Snapshot struct {
	*dejavu.Log
	TypesCount []*TypeCount `json:"typesCount"`
}

func GetRepoSnapshots

func GetRepoSnapshots(page int) (ret []*Snapshot, pageCount, totalCount int, err error)

func GetTagSnapshots

func GetTagSnapshots() (ret []*Snapshot, err error)

type Sync

type Sync struct {
	Size      int64  `json:"size"`
	HSize     string `json:"hSize"`
	Updated   string `json:"updated"`
	CloudName string `json:"cloudName"` // 云端同步数据存放目录名
	SaveDir   string `json:"saveDir"`   // 本地同步数据存放目录路径
}

func ListCloudSyncDir

func ListCloudSyncDir() (syncDirs []*Sync, hSize string, err error)

type Tag

type Tag struct {
	Name     string `json:"name"`
	Label    string `json:"label"`
	Children Tags   `json:"children"`
	Type     string `json:"type"` // "tag"
	Depth    int    `json:"depth"`
	Count    int    `json:"count"`
	// contains filtered or unexported fields
}

type TagBlocks

type TagBlocks []*Block

func (TagBlocks) Len

func (s TagBlocks) Len() int

func (TagBlocks) Less

func (s TagBlocks) Less(i, j int) bool

func (TagBlocks) Swap

func (s TagBlocks) Swap(i, j int)

type Tags

type Tags []*Tag

func BuildTags

func BuildTags() (ret *Tags)

type Transaction

type Transaction struct {
	Timestamp      int64        `json:"timestamp"`
	DoOperations   []*Operation `json:"doOperations"`
	UndoOperations []*Operation `json:"undoOperations"`
	// contains filtered or unexported fields
}

func GetHeadingDeleteTransaction

func GetHeadingDeleteTransaction(id string) (transaction *Transaction, err error)

func GetHeadingLevelTransaction

func GetHeadingLevelTransaction(id string, level int) (transaction *Transaction, err error)

func (*Transaction) WaitForCommit

func (tx *Transaction) WaitForCommit()

type TxErr

type TxErr struct {
	// contains filtered or unexported fields
}

type TxtAssetParser

type TxtAssetParser struct {
}

func (*TxtAssetParser) Parse

func (parser *TxtAssetParser) Parse(absPath string) (ret *AssetParseResult)

type TypeCount

type TypeCount struct {
	Type  string `json:"type"`
	Count int    `json:"count"`
}

type XlsxAssetParser

type XlsxAssetParser struct {
}

func (*XlsxAssetParser) Parse

func (parser *XlsxAssetParser) Parse(absPath string) (ret *AssetParseResult)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL