1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

orm,sqlite,mysql,pg: cleanup import v.ast, using typeof[Type]()

This commit is contained in:
Delyan Angelov
2022-12-07 12:26:41 +02:00
parent 4eb81d2f05
commit 458e68e196
5 changed files with 49 additions and 54 deletions

View File

@ -1,7 +1,6 @@
import orm
import mysql
import time
import v.ast
struct TestCustomSqlType {
id int [primary; sql: serial]
@ -51,7 +50,7 @@ fn test_mysql_orm() {
db.create('Test', [
orm.TableField{
name: 'id'
typ: ast.int_type_idx
typ: typeof[int]().idx
attrs: [
StructAttribute{
name: 'primary'
@ -66,12 +65,12 @@ fn test_mysql_orm() {
},
orm.TableField{
name: 'name'
typ: ast.string_type_idx
typ: typeof[string]().idx
attrs: []
},
orm.TableField{
name: 'age'
typ: ast.int_type_idx
typ: typeof[int]().idx
},
]) or { panic(err) }
@ -84,11 +83,11 @@ fn test_mysql_orm() {
table: 'Test'
has_where: true
fields: ['id', 'name', 'age']
types: [ast.int_type_idx, ast.string_type_idx, ast.i64_type_idx]
types: [typeof[int]().idx, typeof[string]().idx, typeof[i64]().idx]
}, orm.QueryData{}, orm.QueryData{
fields: ['name', 'age']
data: [orm.Primitive('Louis'), i64(101)]
types: [ast.string_type_idx, ast.i64_type_idx]
types: [typeof[string]().idx, typeof[i64]().idx]
is_and: [true, true]
kinds: [.eq, .eq]
}) or { panic(err) }