add table _deleted for make db
This commit is contained in:
parent
cc8c502ec0
commit
183beb1286
10
db.go
10
db.go
@ -186,7 +186,15 @@ func makeDBObject(conn *db.DB, tx *db.Tx) map[string]any {
|
||||
if u.FileExists(tryFile) {
|
||||
erDesc = u.ReadFileN(tryFile)
|
||||
}
|
||||
if err := dao.MakeDBFromDesc(conn, erDesc, logger); err == nil {
|
||||
if err := dao.MakeDBFromDesc(conn, erDesc+`
|
||||
|
||||
_deleted
|
||||
table v30 PK
|
||||
id v30 PK
|
||||
time dt ct
|
||||
owner v30 I
|
||||
data t
|
||||
`, logger); err == nil {
|
||||
return nil
|
||||
} else {
|
||||
panic(vm.NewGoError(err))
|
||||
|
14
db_test.js
14
db_test.js
@ -1,13 +1,19 @@
|
||||
import db from 'apigo.cc/gojs/db'
|
||||
|
||||
function main(testUserName){
|
||||
function main(testUserName) {
|
||||
db.setDefault('sqlite://test.db')
|
||||
db.make(`
|
||||
User
|
||||
User // {api} {select:isValid=1}
|
||||
id i AI
|
||||
name t
|
||||
name v100 // [i]
|
||||
password v100 // [p] {-}
|
||||
age i // [n]
|
||||
sex v10 // [s:Female,Male]
|
||||
memo t // [t]
|
||||
isValid b // [c]
|
||||
version ubi //
|
||||
`)
|
||||
db.insert('User', {name: testUserName})
|
||||
db.insert('User', { name: testUserName })
|
||||
let user = db.query1('SELECT * FROM User').result
|
||||
return user
|
||||
}
|
||||
|
19
go.mod
19
go.mod
@ -1,14 +1,16 @@
|
||||
module apigo.cc/gojs/db
|
||||
|
||||
go 1.18
|
||||
go 1.21
|
||||
|
||||
toolchain go1.22.5
|
||||
|
||||
require (
|
||||
apigo.cc/gojs v0.0.6
|
||||
apigo.cc/gojs v0.0.8
|
||||
github.com/ssgo/dao v0.1.5
|
||||
github.com/ssgo/db v1.7.11
|
||||
github.com/ssgo/log v1.7.7
|
||||
github.com/ssgo/u v1.7.11
|
||||
modernc.org/sqlite v1.34.1
|
||||
github.com/ssgo/u v1.7.13
|
||||
modernc.org/sqlite v1.34.2
|
||||
)
|
||||
|
||||
require (
|
||||
@ -28,11 +30,12 @@ require (
|
||||
github.com/ssgo/config v1.7.9 // indirect
|
||||
github.com/ssgo/standard v1.7.7 // indirect
|
||||
github.com/ssgo/tool v0.4.27 // indirect
|
||||
golang.org/x/sys v0.27.0 // indirect
|
||||
golang.org/x/text v0.20.0 // indirect
|
||||
golang.org/x/exp v0.0.0-20231108232855-2478ac86f678 // indirect
|
||||
golang.org/x/sys v0.28.0 // indirect
|
||||
golang.org/x/text v0.21.0 // indirect
|
||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||
modernc.org/gc/v3 v3.0.0-20240107210532-573471604cb6 // indirect
|
||||
modernc.org/libc v1.55.3 // indirect
|
||||
modernc.org/gc/v3 v3.0.0-20241004144649-1aea3fae8852 // indirect
|
||||
modernc.org/libc v1.61.4 // indirect
|
||||
modernc.org/mathutil v1.6.0 // indirect
|
||||
modernc.org/memory v1.8.0 // indirect
|
||||
modernc.org/strutil v1.2.0 // indirect
|
||||
|
Loading…
Reference in New Issue
Block a user