An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:sparkles: Database grouping by field https://github.com/siyuan-note/siyuan/issues/10964
Danield71db850517f
diff --git a/kernel/av/group.go b/kernel/av/group.gonew file mode 100644index 0000000000..4e78e5ff22--- /dev/null+++ b/kernel/av/group.go@@ -0,0 +1,57 @@+// SiYuan - Refactor your thinking+// Copyright (c) 2020-present, b3log.org+//+// This program is free software: you can redistribute it and/or modify+// it under the terms of the GNU Affero General Public License as published by+// the Free Software Foundation, either version 3 of the License, or+// (at your option) any later version.+//+// This program is distributed in the hope that it will be useful,+// but WITHOUT ANY WARRANTY; without even the implied warranty of+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+// GNU Affero General Public License for more details.+//+// You should have received a copy of the GNU Affero General Public License+// along with this program. If not, see <https://www.gnu.org/licenses/>.++package av++// Groupable 定义了可分组的视图类型。+type Groupable interface {++ // Group 根据视图中设置的分组规则进行分组。+ Group(attrView *AttributeView)+}++type ViewGroup struct {+ Field string `json:"field"` // 分组字段 ID+ Method GroupMethod `json:"method"` // 分组方式+ Range *GroupRange `json:"range,omitempty"` // 分组范围+ Order GroupOrder `json:"order"` // 分组顺序+}++type GroupMethod int++const (+ GroupMethodValue GroupMethod = iota // 按值分组+ GroupMethodRangeNum // 按数字范围分组+ GroupMethodDateRelative // 按相对日期日期分组+ GroupMethodDateDay // 按天日期分组+ GroupMethodDateWeek // 按周日期分组+ GroupMethodDateMonth // 按月日期分组+ GroupMethodDateYear // 按年日期分组+)++// GroupRange 定义了分组范围的结构。+type GroupRange struct {+ NumStart float64 `json:"numStart"` // 数字范围起始值+ NumEnd float64 `json:"numEnd"` // 数字范围结束值+ NumStep float64 `json:"numStep"` // 数字范围步长+}++type GroupOrder string++const (+ GroupOrderAsc GroupOrder = "ASC"+ GroupOrderDesc GroupOrder = "DESC"+)