mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
ci: fix tests (most CI jobs do not have pg set up)
This commit is contained in:
parent
e029044b13
commit
2b6ba63a55
@ -1,4 +1,6 @@
|
|||||||
|
import os
|
||||||
import pg
|
import pg
|
||||||
|
import term
|
||||||
|
|
||||||
struct Modules {
|
struct Modules {
|
||||||
id int
|
id int
|
||||||
@ -9,10 +11,13 @@ struct Modules {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn test_orm() {
|
fn test_orm() {
|
||||||
db := pg.connect(
|
dbname := os.getenv('VDB_NAME')
|
||||||
dbname:'vpm'
|
dbuser := os.getenv('VDB_USER')
|
||||||
user:'alex'
|
if dbname == '' || dbuser == '' {
|
||||||
) or { panic(err) }
|
eprintln(term.red('NB: this test requires VDB_NAME and VDB_USER env variables to be set'))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
db := pg.connect(dbname: dbname, user: dbuser) or { panic(err) }
|
||||||
/*
|
/*
|
||||||
//nr_modules := db.select count from modules
|
//nr_modules := db.select count from modules
|
||||||
//nr_modules := db.select count from Modules where id == 1
|
//nr_modules := db.select count from Modules where id == 1
|
||||||
|
@ -128,7 +128,6 @@ pub fn (db DB) exec_one(query string) ?Row {
|
|||||||
// free. This prevents warnings and doesn't seem to affect behavior.
|
// free. This prevents warnings and doesn't seem to affect behavior.
|
||||||
pub fn (db DB) exec_param_many(query string, params []string) []Row {
|
pub fn (db DB) exec_param_many(query string, params []string) []Row {
|
||||||
unsafe {
|
unsafe {
|
||||||
b := sizeof(byteptr)
|
|
||||||
mut param_vals := &byteptr(malloc(params.len * 8))
|
mut param_vals := &byteptr(malloc(params.len * 8))
|
||||||
for i in 0..params.len {
|
for i in 0..params.len {
|
||||||
param_vals[i] = params[i].str
|
param_vals[i] = params[i].str
|
||||||
|
Loading…
Reference in New Issue
Block a user