Documentation
¶
Index ¶
- func AssignMaintainer(ctx context.Context, sessionID, nameID int64) error
- func CreateOrGetSessionID(ctx context.Context) (sessionID int64, err error)
- func CreateOrGetSessionIDByPath(ctx context.Context, projectPath string) (sessionID int64, err error)
- func GetCurrentSessionID(ctx context.Context) (sessionID int64)
- func RemoveProject(ctx context.Context, sessionID int64) error
- func ResetSessionID()
- func UpdateProjectPath(ctx context.Context, sessionID int64, newPath string) error
- type ProjectRow
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AssignMaintainer ¶
AssignMaintainer assigns a maintainer (ai_names.id) to a session (sessions.id). Uses UPSERT — replaces any existing assignment for that session.
func CreateOrGetSessionID ¶
CreateOrGetSessionID 获取或创建当前 context.ProjectRoot 的会话ID。 委托给 CreateOrGetSessionIDByPath。
func CreateOrGetSessionIDByPath ¶ added in v0.8.8
func CreateOrGetSessionIDByPath(ctx context.Context, projectPath string) (sessionID int64, err error)
CreateOrGetSessionIDByPath 获取或创建指定项目路径对应的会话ID。 如果该路径尚未有 session 行则自动创建。
func GetCurrentSessionID ¶
GetCurrentSessionID 获取当前会话ID(线程安全,仅初始化一次)
func RemoveProject ¶ added in v0.8.8
RemoveProject removes a session (project) by ID. Deletes all associated data (session_names, memories, messages, notes, chimeins) before deleting the session itself. Returns an error if the session does not exist.
func ResetSessionID ¶
func ResetSessionID()
ResetSessionID clears the cached session ID so the next call to GetCurrentSessionID will re-resolve against the current database. Intended for tests that switch database paths.
Types ¶
type ProjectRow ¶
type ProjectRow struct {
ID int64
ProjectPath string
CreatedAt string
MaintainerCN string // e.g. "玻尔" or empty
MaintainerEN string // e.g. "Bohr" or empty
MaintainerID int64 // ai_names.id, 0 if none
}
ProjectRow represents a row from the sessions table.
func GetProjectInfo ¶ added in v0.8.8
func GetProjectInfo(ctx context.Context, projectPath string) ProjectRow
func ListProjects ¶
func ListProjects(ctx context.Context) ([]ProjectRow, error)
ListProjects returns all sessions with their maintainer, ordered by ID.