{"version":3,"file":"update-query-builder.mjs","names":[],"sources":["../../../../src/libs/db/query-builder/update-query-builder.ts"],"sourcesContent":["import type { UpdateQueryBuilder } from \"kysely\";\nimport type { LucidDB } from \"../types.js\";\nimport type { QueryBuilderWhere } from \"./index.js\";\n\nconst updateQueryBuilder = <\n\tUT extends keyof LucidDB,\n\tTable extends keyof LucidDB,\n\tO,\n>(\n\tquery: UpdateQueryBuilder<LucidDB, UT, Table, O>,\n\twhere: QueryBuilderWhere<Table>,\n) => {\n\tlet kyselyQuery = query;\n\n\tfor (const { key, operator, value, condition } of where) {\n\t\tconst shouldApply =\n\t\t\ttypeof condition === \"function\" ? condition() : condition;\n\t\tif (shouldApply === false) continue;\n\n\t\tkyselyQuery = kyselyQuery.where(key, operator, value);\n\t}\n\n\treturn kyselyQuery;\n};\n\nexport default updateQueryBuilder;\n"],"mappings":"AAIA,MAAM,GAKL,EACA,IACI,CACJ,IAAI,EAAc,EAElB,IAAK,GAAM,CAAE,MAAK,WAAU,QAAO,eAAe,GAEhD,OAAO,GAAc,WAAa,EAAU,EAAI,KAC7B,KAEpB,EAAc,EAAY,MAAM,EAAK,EAAU,CAAK,GAGrD,OAAO,CACR"}