session

package
v0.8.7 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AssignMaintainer

func AssignMaintainer(sessionID, nameID int64) error

AssignMaintainer assigns a maintainer (ai_names.id) to a session (sessions.id). Uses UPSERT — replaces any existing assignment for that session.

func CreateOrGetSessionID

func CreateOrGetSessionID(ctx context.Context) (sessionID int64, err error)

CreateOrGetSessionID 获取或创建会话ID

func GetCurrentSessionID

func GetCurrentSessionID(ctx context.Context) (sessionID int64)

GetCurrentSessionID 获取当前会话ID(线程安全,仅初始化一次)

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.

func UpdateProjectPath

func UpdateProjectPath(sessionID int64, newPath string) error

UpdateProjectPath updates the project_path for a given session. Returns an error if the session does not exist or the path is empty.

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 ListProjects

func ListProjects() ([]ProjectRow, error)

ListProjects returns all sessions with their maintainer, ordered by ID.

Jump to

Keyboard shortcuts

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