db/db_test.js

20 lines
539 B
JavaScript
Raw Permalink Normal View History

2024-10-11 11:32:50 +08:00
import db from 'apigo.cc/gojs/db'
2024-12-13 19:34:51 +08:00
function main(testUserName) {
2024-10-11 11:32:50 +08:00
db.setDefault('sqlite://test.db')
db.make(`
2024-12-13 19:34:51 +08:00
User // {api} {select:isValid=1}
2024-10-11 11:32:50 +08:00
id i AI
2024-12-13 19:34:51 +08:00
name v100 // [i]
password v100 // [p] {-}
age i // [n]
sex v10 // [s:Female,Male]
memo t // [t]
isValid b // [c]
version ubi //
2024-10-11 11:32:50 +08:00
`)
2024-12-13 19:34:51 +08:00
db.insert('User', { name: testUserName })
2024-10-11 11:32:50 +08:00
let user = db.query1('SELECT * FROM User').result
return user
}