sqlite

package
v0.1.7 Latest Latest
Warning

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

Go to latest
Published: May 20, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AgentRepository

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

AgentRepository 提供 SQLite 的 Agent 仓储实现。

func NewAgentRepository

func NewAgentRepository(db *sql.DB) *AgentRepository

NewAgentRepository 创建 Agent 仓储。

func (*AgentRepository) ArchiveAgent

func (r *AgentRepository) ArchiveAgent(ctx context.Context, agentID string, ownerUserID string) error

ArchiveAgent 软删除 Agent。

func (*AgentRepository) CreateAgent

func (r *AgentRepository) CreateAgent(ctx context.Context, record agentrepo.CreateRecord) (*protocol.Agent, error)

CreateAgent 创建 Agent、Profile 与 Runtime。

func (*AgentRepository) ExistsActiveAgentName

func (r *AgentRepository) ExistsActiveAgentName(ctx context.Context, ownerUserID string, name string, excludeAgentID string) (bool, error)

ExistsActiveAgentName 检查活跃名称是否已占用。

func (*AgentRepository) GetAgent

func (r *AgentRepository) GetAgent(ctx context.Context, agentID string, ownerUserID string) (*protocol.Agent, error)

GetAgent 返回指定 Agent。

func (*AgentRepository) GetMainAgent

func (r *AgentRepository) GetMainAgent(ctx context.Context, ownerUserID string) (*protocol.Agent, error)

GetMainAgent 返回指定用户的主智能体。

func (*AgentRepository) ListActiveAgents

func (r *AgentRepository) ListActiveAgents(ctx context.Context, ownerUserID string) ([]protocol.Agent, error)

ListActiveAgents 返回所有活跃 Agent。

func (*AgentRepository) UpdateAgent

func (r *AgentRepository) UpdateAgent(ctx context.Context, record agentrepo.UpdateRecord) (*protocol.Agent, error)

UpdateAgent 更新 Agent 配置。

type Repository

type Repository struct {
	DB *sql.DB
}

Repository 提供 SQLite 仓储骨架。

func New

func New(db *sql.DB) *Repository

New 创建 SQLite 仓储。

type RoomRepository

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

RoomRepository 提供 SQLite 的 Room 仓储实现。

func NewRoomRepository

func NewRoomRepository(db *sql.DB) *RoomRepository

NewRoomRepository 创建 Room 仓储。

func (*RoomRepository) AddRoomMember

func (r *RoomRepository) AddRoomMember(ctx context.Context, ownerUserID string, roomID string, agent roomrepo.AgentRuntimeRef) (*protocol.ConversationContextAggregate, error)

AddRoomMember 向房间追加成员。

func (*RoomRepository) CreateConversation

CreateConversation 创建房间话题。

func (*RoomRepository) CreateRoom

CreateRoom 创建房间、主对话和初始会话。

func (*RoomRepository) DeleteConversation

func (r *RoomRepository) DeleteConversation(ctx context.Context, ownerUserID string, roomID string, conversationID string) (*protocol.ConversationContextAggregate, error)

DeleteConversation 删除话题并返回回退上下文。

func (*RoomRepository) DeleteRoom

func (r *RoomRepository) DeleteRoom(ctx context.Context, ownerUserID string, roomID string) (bool, error)

DeleteRoom 删除房间。

func (*RoomRepository) FindDMRoomContext

func (r *RoomRepository) FindDMRoomContext(ctx context.Context, ownerUserID string, agentID string) (*protocol.ConversationContextAggregate, error)

FindDMRoomContext 查找指定 Agent 的 DM 上下文。

func (*RoomRepository) GetConversationContext

func (r *RoomRepository) GetConversationContext(ctx context.Context, ownerUserID string, conversationID string) (*protocol.ConversationContextAggregate, error)

GetConversationContext 按 conversation_id 读取单条房间上下文。

func (*RoomRepository) GetRoom

func (r *RoomRepository) GetRoom(ctx context.Context, ownerUserID string, roomID string) (*protocol.RoomAggregate, error)

GetRoom 读取单个房间。

func (*RoomRepository) GetRoomContexts

func (r *RoomRepository) GetRoomContexts(ctx context.Context, ownerUserID string, roomID string) ([]protocol.ConversationContextAggregate, error)

GetRoomContexts 读取房间上下文。

func (*RoomRepository) ListRecentRooms

func (r *RoomRepository) ListRecentRooms(ctx context.Context, ownerUserID string, limit int) ([]protocol.RoomAggregate, error)

ListRecentRooms 列出最近房间。

func (*RoomRepository) LoadAgentRuntimeRefs

func (r *RoomRepository) LoadAgentRuntimeRefs(ctx context.Context, ownerUserID string, agentIDs []string) ([]roomrepo.AgentRuntimeRef, error)

LoadAgentRuntimeRefs 读取建房所需的 Agent 运行时信息。

func (*RoomRepository) RemoveRoomMember

func (r *RoomRepository) RemoveRoomMember(ctx context.Context, ownerUserID string, roomID string, agentID string) (*protocol.ConversationContextAggregate, error)

RemoveRoomMember 从房间移除成员。

func (*RoomRepository) UpdateConversation

func (r *RoomRepository) UpdateConversation(ctx context.Context, ownerUserID string, roomID string, conversationID string, title string) (*protocol.ConversationContextAggregate, error)

UpdateConversation 更新话题标题。

func (*RoomRepository) UpdateRoom

func (r *RoomRepository) UpdateRoom(
	ctx context.Context,
	ownerUserID string,
	roomID string,
	name *string,
	description *string,
	title *string,
	avatar *string,
	skillNames *[]string,
	hostAgentID *string,
	hostAutoReplyEnabled *bool,
) (*protocol.ConversationContextAggregate, error)

UpdateRoom 更新房间及主对话标题。

func (*RoomRepository) UpdateSessionSDKSessionID

func (r *RoomRepository) UpdateSessionSDKSessionID(ctx context.Context, sessionID string, sdkSessionID string) error

UpdateSessionSDKSessionID 更新房间会话记录上的 Claude session_id。

type SessionRepository

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

SessionRepository 提供 SQLite 的 Room Session 视图查询。

func NewSessionRepository

func NewSessionRepository(db *sql.DB) *SessionRepository

NewSessionRepository 创建 SessionRepository。

func (*SessionRepository) GetRoomSessionByKey

func (r *SessionRepository) GetRoomSessionByKey(ctx context.Context, ownerUserID string, key protocol.SessionKey) (*protocol.Session, error)

GetRoomSessionByKey 按结构化 key 查找 Room 成员会话。

func (*SessionRepository) ListRoomSessions

func (r *SessionRepository) ListRoomSessions(ctx context.Context, ownerUserID string) ([]protocol.Session, error)

ListRoomSessions 列出全部 Room 成员会话视图。

func (*SessionRepository) ListRoomSessionsByAgent

func (r *SessionRepository) ListRoomSessionsByAgent(ctx context.Context, agentID string) ([]protocol.Session, error)

ListRoomSessionsByAgent 列出指定 Agent 的 Room 成员会话视图。

func (*SessionRepository) UpdateRoomSessionSDKSessionID

func (r *SessionRepository) UpdateRoomSessionSDKSessionID(
	ctx context.Context,
	roomSessionID string,
	sdkSessionID string,
) error

UpdateRoomSessionSDKSessionID 回写 Room 成员会话的 sdk_session_id。

Jump to

Keyboard shortcuts

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