MCPcopy Create free account
hub / github.com/Chat2AnyLLM/code-agent-manager / getTx

Function getTx

internal/instructions/store.go:174–193  ·  view source on GitHub ↗
(ctx context.Context, q queryer, id int64)

Source from the content-addressed store, hash-verified

172}
173
174func getTx(ctx context.Context, q queryer, id int64) (Instruction, error) {
175 var in Instruction
176 var created, updated string
177 err := q.QueryRowContext(ctx, `SELECT id, name, description, content, created_at, updated_at FROM instructions WHERE id = ?`, id).
178 Scan(&in.ID, &in.Name, &in.Description, &in.Content, &created, &updated)
179 if err == sql.ErrNoRows {
180 return Instruction{}, ErrInstructionNotFound
181 }
182 if err != nil {
183 return Instruction{}, fmt.Errorf("instructions: get: %w", err)
184 }
185 in.CreatedAt = parseTime(created)
186 in.UpdatedAt = parseTime(updated)
187 installs, err := installsFor(ctx, q, id)
188 if err != nil {
189 return Instruction{}, err
190 }
191 in.Installs = installs
192 return in, nil
193}
194
195// queryer abstracts *sql.DB and *sql.Tx for shared read helpers.
196type queryer interface {

Callers 3

GetMethod · 0.85
UpdateMethod · 0.85
DeleteMethod · 0.85

Calls 3

parseTimeFunction · 0.85
installsForFunction · 0.85
QueryRowContextMethod · 0.80

Tested by

no test coverage detected