MCPcopy Create free account
hub / github.com/Kilo-Org/cloud / insertWantedDML

Function insertWantedDML

packages/wl-sdk/src/commons/dml.generated.ts:60–83  ·  view source on GitHub ↗
(input: InsertWantedInput)

Source from the content-addressed store, hash-verified

58 * (id, title) and returns a single multi-row INSERT statement.
59 */
60export function insertWantedDML(input: InsertWantedInput): string {
61 if (input.id === '') throw new Error('wanted item ID cannot be empty');
62 if (input.title === '') throw new Error('wanted item title cannot be empty');
63
64 const now = input.now ?? formatNowUtc(new Date());
65 const tagsJson = formatTagsJson(input.tags);
66
67 const descField = sqlStringOrNull(input.description);
68 const projectField = sqlStringOrNull(input.project);
69 const typeField = sqlStringOrNull(input.type);
70 const postedByField = sqlStringOrNull(input.postedBy);
71 const effortField =
72 input.effortLevel && input.effortLevel !== ''
73 ? `'${escapeSqlString(input.effortLevel)}'`
74 : "'medium'";
75 const status =
76 input.status && input.status !== '' ? `'${escapeSqlString(input.status)}'` : "'open'";
77 const priority = input.priority ?? 0;
78
79 return (
80 `INSERT INTO wanted (id, title, description, project, type, priority, tags, posted_by, status, effort_level, created_at, updated_at)\n` +
81 `VALUES ('${escapeSqlString(input.id)}', '${escapeSqlString(input.title)}', ${descField}, ${projectField}, ${typeField}, ${priority}, ${tagsJson}, ${postedByField}, ${status}, ${effortField}, '${now}', '${now}')`
82 );
83}
84
85// ClaimWantedDML (commons.go:329)
86

Callers 2

postFunction · 0.90

Calls 4

sqlStringOrNullFunction · 0.90
escapeSqlStringFunction · 0.90
formatNowUtcFunction · 0.85
formatTagsJsonFunction · 0.85

Tested by

no test coverage detected