{"version":3,"file":"select-query-builder.mjs","names":[],"sources":["../../../../src/libs/db/query-builder/select-query-builder.ts"],"sourcesContent":["import type { SelectQueryBuilder } from \"kysely\";\nimport type { LucidDB } from \"../types.js\";\nimport type { QueryBuilderWhere } from \"./index.js\";\n\nconst selectQueryBuilder = <Table extends keyof LucidDB, O>(\n\tquery: SelectQueryBuilder<LucidDB, 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 selectQueryBuilder;\n"],"mappings":"AAIA,MAAM,GACL,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"}