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

Function nameExists

internal/instructions/store.go:221–231  ·  view source on GitHub ↗

nameExists reports whether a row with name exists, optionally excluding an id.

(ctx context.Context, q queryer, name string, excludeID int64)

Source from the content-addressed store, hash-verified

219
220// nameExists reports whether a row with name exists, optionally excluding an id.
221func nameExists(ctx context.Context, q queryer, name string, excludeID int64) (bool, error) {
222 var existingID int64
223 err := q.QueryRowContext(ctx, `SELECT id FROM instructions WHERE name = ?`, name).Scan(&existingID)
224 if err == sql.ErrNoRows {
225 return false, nil
226 }
227 if err != nil {
228 return false, err
229 }
230 return existingID != excludeID, nil
231}
232
233// writeManagedFile atomically writes content to the managed file for name.
234func writeManagedFile(name, content string) error {

Callers 2

CreateMethod · 0.85
UpdateMethod · 0.85

Calls 1

QueryRowContextMethod · 0.80

Tested by

no test coverage detected