mirror of
https://github.com/pinpox/gitea-matrix-bot
synced 2024-11-22 19:31:58 +01:00
fixed db, implemented missing methods
This commit is contained in:
parent
e0f207590e
commit
362d9d0296
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,3 +1,4 @@
|
||||
tags
|
||||
config.ini
|
||||
gitea-matrix-bot
|
||||
tokens.db
|
||||
|
@ -50,7 +50,7 @@ func (dbg *GiteaDB) GetToken(room string) string {
|
||||
}
|
||||
defer db.Close()
|
||||
|
||||
stmt, err := db.Prepare("select name from foo where id = ?")
|
||||
stmt, err := db.Prepare("select token from tokens where room = ?")
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
@ -134,17 +134,20 @@ func (dbg *GiteaDB) Set(room, token string) {
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
fmt.Println("inserting")
|
||||
|
||||
stmt, err := tx.Prepare("insert into tokens(room, token) values(?, ?)")
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
defer stmt.Close()
|
||||
for i := 0; i < 100; i++ {
|
||||
_, err = stmt.Exec(room, token)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
}
|
||||
tx.Commit()
|
||||
|
||||
dbg.GetAll()
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user