MCPcopy Index your code
hub / github.com/docker/docker-agent / addSessionTx

Method addSessionTx

pkg/session/store.go:1121–1140  ·  view source on GitHub ↗

addSessionTx inserts a session within a transaction.

(ctx context.Context, tx *sql.Tx, session *Session)

Source from the content-addressed store, hash-verified

1119
1120// addSessionTx inserts a session within a transaction.
1121func (s *SQLiteSessionStore) addSessionTx(ctx context.Context, tx *sql.Tx, session *Session) error {
1122 fields, err := sessionPersistedFieldsOf(session)
1123 if err != nil {
1124 return err
1125 }
1126
1127 _, err = tx.ExecContext(ctx,
1128 `INSERT INTO sessions (
1129 id, tools_approved, input_tokens, output_tokens, title, cost, send_user_message,
1130 max_iterations, working_dir, created_at, starred, permissions, agent_model_overrides,
1131 custom_models_used, thinking, parent_id
1132 )
1133 VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`,
1134 session.ID, session.ToolsApproved, session.InputTokens, session.OutputTokens,
1135 session.Title, session.Cost, session.SendUserMessage, session.MaxIterations,
1136 session.WorkingDir, session.CreatedAt.Format(time.RFC3339), session.Starred,
1137 fields.PermissionsJSON, fields.AgentModelOverridesJSON, fields.CustomModelsUsedJSON, false,
1138 fields.ParentID)
1139 return err
1140}
1141
1142// addItemTx inserts a session item within a transaction.
1143func (s *SQLiteSessionStore) addItemTx(ctx context.Context, tx *sql.Tx, sessionID string, position int, item Item) error {

Callers 2

AddSubSessionMethod · 0.95
addItemTxMethod · 0.95

Calls 2

sessionPersistedFieldsOfFunction · 0.85
ExecContextMethod · 0.80

Tested by

no test coverage detected