mysql icon indicating copy to clipboard operation
mysql copied to clipboard

Use template literals

Open algj opened this issue 5 years ago • 4 comments
trafficstars

I haven't tested it. Please test it if it works correctly.

Usage:

import { Client, SQL } from "https://deno.land/x/mysql/mod.ts";
const client = await new Client().connect({...options...});

client.query(SQL`select $${"name"} from $${"users"} where id = ${5}`);
// is exactly the same as:
client.query("select  ??  from  ??  where id =  ?", [ "name", "users", 5 ]);

algj avatar Jun 17 '20 09:06 algj

Tests fail on my try. Have u ever run the Unit Test though? Do they pass or not?

wenjoy avatar Jun 18 '20 05:06 wenjoy

Have u ever run the Unit Test though? Do they pass or not?

I haven't tested anything. If you get any error, tell me.

algj avatar Jun 18 '20 08:06 algj

@algiuxass Just run deno test --allow-env --allow-net test.ts. Basically , we should make sure the coming code will not break the unit test.

wenjoy avatar Jun 19 '20 02:06 wenjoy

We always hope that new changes can be covered by corresponding tests

manyuanrong avatar Jun 22 '20 02:06 manyuanrong