diff --git a/doc/docs.md b/doc/docs.md index 4fae90b7f8..ef32808ae9 100644 --- a/doc/docs.md +++ b/doc/docs.md @@ -1470,27 +1470,27 @@ struct Customer { // struct name has to be the same as the table name (for now) country string } -db := pg.connect(db_name, db_user) +db := sqlite.connect('customers.db') // select count(*) from Customer -nr_customers := db.select count from Customer +nr_customers := sql db { select count from Customer } println('number of all customers: $nr_customers') // V syntax can be used to build queries // db.select returns an array -uk_customers := db.select from Customer where country == 'uk' && nr_orders > 0 +uk_customers := sql db { select from Customer where country == 'uk' && nr_orders > 0 } println(uk_customers.len) for customer in uk_customers { println('$customer.id - $customer.name') } // by adding `limit 1` we tell V that there will be only one object -customer := db.select from Customer where id == 1 limit 1 +customer := sql db { select from Customer where id == 1 limit 1 } println('$customer.id - $customer.name') // insert a new customer new_customer := Customer{name: 'Bob', nr_orders: 10} -db.insert(new_customer) +sql db { insert new_customer into Customer } ``` ## vfmt