Skip to content

Commit

Permalink
fix(sqlite): slice operation
Browse files Browse the repository at this point in the history
  • Loading branch information
fumiama committed Feb 14, 2025
1 parent 708bfd0 commit 02e9f18
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 8 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ require (
github.com/FloatTech/floatbox v0.0.0-20241106130736-5aea0a935024
github.com/FloatTech/imgfactory v0.2.2-0.20230315152233-49741fc994f9
github.com/FloatTech/rendercard v0.2.0
github.com/FloatTech/sqlite v1.7.0
github.com/FloatTech/sqlite v1.7.1
github.com/FloatTech/zbpctrl v1.7.0
github.com/RomiChan/syncx v0.0.0-20240418144900-b7402ffdebc7
github.com/RomiChan/websocket v1.4.3-0.20220227141055-9b2c6168c9c5
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ github.com/FloatTech/imgfactory v0.2.2-0.20230315152233-49741fc994f9 h1:IzZLuM/f
github.com/FloatTech/imgfactory v0.2.2-0.20230315152233-49741fc994f9/go.mod h1:el5hGpj1C1bDRxcTXYRwEivDCr40zZeJpcrLrB1fajs=
github.com/FloatTech/rendercard v0.2.0 h1:PBTZ2gCEy/dAEGSfWecrGTrWDYpiBJD1dVzNDDaOxh4=
github.com/FloatTech/rendercard v0.2.0/go.mod h1:Sbojcy1t3NfFz7/WicZRmR/uKFxNMYkKF8qHx69dxY0=
github.com/FloatTech/sqlite v1.7.0 h1:FGSn4pCR12kESozn7IvNx3U39dwR/AcFM9oPyGACsl0=
github.com/FloatTech/sqlite v1.7.0/go.mod h1:/4tzfCGhrZnnjC1U8vcfwGQeF6eR649fhOsS3+Le0+s=
github.com/FloatTech/sqlite v1.7.1 h1:XKUY0+MNaRmvEIgRv7QLbl7PFVpUfQ72+XQg+no2Vq0=
github.com/FloatTech/sqlite v1.7.1/go.mod h1:/4tzfCGhrZnnjC1U8vcfwGQeF6eR649fhOsS3+Le0+s=
github.com/FloatTech/ttl v0.0.0-20240716161252-965925764562 h1:snfw7FNFym1eNnLrQ/VCf80LiQo9C7jHgrunZDwiRcY=
github.com/FloatTech/ttl v0.0.0-20240716161252-965925764562/go.mod h1:fHZFWGquNXuHttu9dUYoKuNbm3dzLETnIOnm1muSfDs=
github.com/FloatTech/zbpctrl v1.7.0 h1:Hxo6EIhJo+pHjcQP9QgIJgluaT1pHH99zkk3njqTNMo=
Expand Down
6 changes: 4 additions & 2 deletions job/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,8 @@ func rmcmd(bot, caller int64, cron string) error {
return err
}
if len(delids) > 0 {
return db.Del(bots, "WHERE id IN ?", delids)
q, s := sql.QuerySet("WHERE id", "IN", delids)
return db.Del(bots, q, s...)
}
return nil
}
Expand All @@ -492,7 +493,8 @@ func delcmd(bot int64, cron string) error {
return err
}
if len(delids) > 0 {
return db.Del(bots, "WHERE id IN ?", delids)
q, s := sql.QuerySet("WHERE id", "IN", delids)
return db.Del(bots, q, s...)
}
return nil
}
Expand Down
7 changes: 5 additions & 2 deletions job/regexqa.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import (

"github.com/FloatTech/floatbox/binary"
"github.com/FloatTech/floatbox/process"
sql "github.com/FloatTech/sqlite"

"github.com/FloatTech/zbputils/ctxext"
)
Expand Down Expand Up @@ -91,7 +92,8 @@ func removeRegex(gid, uid int64, bots, pattern string) error {
return nil
}, cr)
if len(delids) > 0 {
return db.Del(bots, "WHERE id IN ?", delids)
q, s := sql.QuerySet("WHERE id", "IN", delids)
return db.Del(bots, q, s...)
}
return nil
}
Expand All @@ -110,7 +112,8 @@ func removeInjectRegex(gid, uid int64, bots, pattern string) error {
return nil
}, cr)
if len(delids) > 0 {
return db.Del(bots, "WHERE id IN ?", delids)
q, s := sql.QuerySet("WHERE id", "IN", delids)
return db.Del(bots, q, s...)
}
return nil
}
Expand Down
4 changes: 3 additions & 1 deletion job/web.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (

"github.com/FloatTech/floatbox/binary"
"github.com/FloatTech/floatbox/process"
sql "github.com/FloatTech/sqlite"
"github.com/sirupsen/logrus"
zero "github.com/wdvxdr1123/ZeroBot"
"github.com/wdvxdr1123/ZeroBot/message"
Expand Down Expand Up @@ -448,7 +449,8 @@ func Delete(req *DeleteReq) (err error) {
return
}
if len(delids) > 0 {
err = db.Del(bots, "WHERE id IN ?", delids)
q, s := sql.QuerySet("WHERE id", "IN", delids)
err = db.Del(bots, q, s...)
if err != nil {
return
}
Expand Down

0 comments on commit 02e9f18

Please sign in to comment.