From a98162118b8ff9d0ba6c9159905103b52b6fe041 Mon Sep 17 00:00:00 2001 From: Lukas Neubert Date: Mon, 30 Nov 2020 14:02:36 +0100 Subject: [PATCH] fmt: orm delete (#7035) --- vlib/v/fmt/fmt.v | 4 +++- vlib/v/fmt/tests/orm_keep.vv | 4 ++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/vlib/v/fmt/fmt.v b/vlib/v/fmt/fmt.v index bc9fd3c3ee..a469c1402d 100644 --- a/vlib/v/fmt/fmt.v +++ b/vlib/v/fmt/fmt.v @@ -471,7 +471,9 @@ pub fn (mut f Fmt) stmt(node ast.Stmt) { f.writeln('') } .delete { - // TODO delete + f.write('\tdelete from ${util.strip_mod_name(node.table_name)} where ') + f.expr(node.where_expr) + f.writeln('') } } f.writeln('}') diff --git a/vlib/v/fmt/tests/orm_keep.vv b/vlib/v/fmt/tests/orm_keep.vv index 33c5a7917a..ca4a56ebbe 100644 --- a/vlib/v/fmt/tests/orm_keep.vv +++ b/vlib/v/fmt/tests/orm_keep.vv @@ -42,4 +42,8 @@ fn main() { sql db { insert new_customer into Customer } + // delete a row + sql db { + delete from Customer where nr_orders == 10 && name == 'Bob' + } }