mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
fmt: remove space in front of ? and ! (#14366)
This commit is contained in:
@@ -10,12 +10,12 @@ pub fn (db DB) @select(config orm.SelectConfig, data orm.QueryData, where orm.Qu
|
||||
query := orm.orm_select_gen(config, '"', true, '$', 1, where)
|
||||
mut ret := [][]orm.Primitive{}
|
||||
|
||||
res := pg_stmt_worker(db, query, orm.QueryData{}, where) ?
|
||||
res := pg_stmt_worker(db, query, orm.QueryData{}, where)?
|
||||
|
||||
for row in res {
|
||||
mut row_data := []orm.Primitive{}
|
||||
for i, val in row.vals {
|
||||
field := str_to_primitive(val, config.types[i]) ?
|
||||
field := str_to_primitive(val, config.types[i])?
|
||||
row_data << field
|
||||
}
|
||||
ret << row_data
|
||||
@@ -28,17 +28,17 @@ pub fn (db DB) @select(config orm.SelectConfig, data orm.QueryData, where orm.Qu
|
||||
|
||||
pub fn (db DB) insert(table string, data orm.QueryData) ? {
|
||||
query := orm.orm_stmt_gen(table, '"', .insert, true, '$', 1, data, orm.QueryData{})
|
||||
pg_stmt_worker(db, query, data, orm.QueryData{}) ?
|
||||
pg_stmt_worker(db, query, data, orm.QueryData{})?
|
||||
}
|
||||
|
||||
pub fn (db DB) update(table string, data orm.QueryData, where orm.QueryData) ? {
|
||||
query := orm.orm_stmt_gen(table, '"', .update, true, '$', 1, data, where)
|
||||
pg_stmt_worker(db, query, data, where) ?
|
||||
pg_stmt_worker(db, query, data, where)?
|
||||
}
|
||||
|
||||
pub fn (db DB) delete(table string, where orm.QueryData) ? {
|
||||
query := orm.orm_stmt_gen(table, '"', .delete, true, '$', 1, orm.QueryData{}, where)
|
||||
pg_stmt_worker(db, query, orm.QueryData{}, where) ?
|
||||
pg_stmt_worker(db, query, orm.QueryData{}, where)?
|
||||
}
|
||||
|
||||
pub fn (db DB) last_id() orm.Primitive {
|
||||
@@ -51,12 +51,12 @@ pub fn (db DB) last_id() orm.Primitive {
|
||||
|
||||
pub fn (db DB) create(table string, fields []orm.TableField) ? {
|
||||
query := orm.orm_table_gen(table, '"', true, 0, fields, pg_type_from_v, false) or { return err }
|
||||
pg_stmt_worker(db, query, orm.QueryData{}, orm.QueryData{}) ?
|
||||
pg_stmt_worker(db, query, orm.QueryData{}, orm.QueryData{})?
|
||||
}
|
||||
|
||||
pub fn (db DB) drop(table string) ? {
|
||||
query := 'DROP TABLE "$table";'
|
||||
pg_stmt_worker(db, query, orm.QueryData{}, orm.QueryData{}) ?
|
||||
pg_stmt_worker(db, query, orm.QueryData{}, orm.QueryData{})?
|
||||
}
|
||||
|
||||
// utils
|
||||
@@ -267,7 +267,7 @@ fn str_to_primitive(str string, typ int) ?orm.Primitive {
|
||||
}
|
||||
orm.time {
|
||||
if str.contains_any(' /:-') {
|
||||
date_time_str := time.parse(str) ?
|
||||
date_time_str := time.parse(str)?
|
||||
return orm.Primitive(date_time_str)
|
||||
}
|
||||
|
||||
|
||||
@@ -126,7 +126,7 @@ pub fn (db DB) close() {
|
||||
// converted to an int. If no row is found or on
|
||||
// command failure, an error is returned
|
||||
pub fn (db DB) q_int(query string) ?int {
|
||||
rows := db.exec(query) ?
|
||||
rows := db.exec(query)?
|
||||
if rows.len == 0 {
|
||||
return error('q_int "$query" not found')
|
||||
}
|
||||
@@ -143,7 +143,7 @@ pub fn (db DB) q_int(query string) ?int {
|
||||
// as a string. If no row is found or on
|
||||
// command failure, an error is returned
|
||||
pub fn (db DB) q_string(query string) ?string {
|
||||
rows := db.exec(query) ?
|
||||
rows := db.exec(query)?
|
||||
if rows.len == 0 {
|
||||
return error('q_string "$query" not found')
|
||||
}
|
||||
@@ -182,7 +182,7 @@ pub fn (db DB) exec_one(query string) ?Row {
|
||||
if e != '' {
|
||||
return error('pg exec error: "$e"')
|
||||
}
|
||||
row := rows_first_or_empty(res_to_rows(res)) ?
|
||||
row := rows_first_or_empty(res_to_rows(res))?
|
||||
return row
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user