From ed63b62b0a0b514ac6a5b1e4c133476a434ea202 Mon Sep 17 00:00:00 2001 From: Roland Osborne Date: Thu, 26 Jan 2023 22:59:58 -0800 Subject: [PATCH] updating gorm --- net/server/go.mod | 8 ++++---- net/server/go.sum | 10 ++++++++++ net/server/internal/api_addChannelTopic.go | 6 +++--- net/server/internal/api_setChannelRevision.go | 6 +++--- 4 files changed, 20 insertions(+), 10 deletions(-) diff --git a/net/server/go.mod b/net/server/go.mod index 3fa6f525..ee943422 100644 --- a/net/server/go.mod +++ b/net/server/go.mod @@ -13,10 +13,10 @@ require ( github.com/gorilla/mux v1.8.0 // indirect github.com/gorilla/websocket v1.4.2 // indirect github.com/jinzhu/inflection v1.0.0 // indirect - github.com/jinzhu/now v1.1.4 // indirect + github.com/jinzhu/now v1.1.5 // indirect github.com/kr/pretty v0.3.0 // indirect github.com/kr/text v0.2.0 // indirect - github.com/mattn/go-sqlite3 v1.14.9 // indirect + github.com/mattn/go-sqlite3 v1.14.16 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/rogpeppe/go-internal v1.6.1 // indirect github.com/stretchr/testify v1.7.0 // indirect @@ -28,6 +28,6 @@ require ( golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f // indirect golang.org/x/tools v0.1.11 // indirect gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c // indirect - gorm.io/driver/sqlite v1.2.6 // indirect - gorm.io/gorm v1.22.5 // indirect + gorm.io/driver/sqlite v1.4.4 // indirect + gorm.io/gorm v1.24.3 // indirect ) diff --git a/net/server/go.sum b/net/server/go.sum index c0cf8a59..8b89f8cf 100644 --- a/net/server/go.sum +++ b/net/server/go.sum @@ -25,6 +25,8 @@ github.com/jinzhu/now v1.1.3 h1:PlHq1bSCSZL9K0wUhbm2pGLoTWs2GwVhsP6emvGV/ZI= github.com/jinzhu/now v1.1.3/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8= github.com/jinzhu/now v1.1.4 h1:tHnRBy1i5F2Dh8BAFxqFzxKqqvezXrL2OW1TnX+Mlas= github.com/jinzhu/now v1.1.4/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8= +github.com/jinzhu/now v1.1.5 h1:/o9tlHleP7gOFmsnYNz3RGnqzefHA47wQpKrrdTIwXQ= +github.com/jinzhu/now v1.1.5/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0= github.com/kr/pretty v0.3.0/go.mod h1:640gp4NfQd8pI5XOwp5fnNeVWj67G7CFk/SaSQn7NBk= @@ -34,6 +36,9 @@ github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/mattn/go-sqlite3 v1.14.9 h1:10HX2Td0ocZpYEjhilsuo6WWtUqttj2Kb0KtD86/KYA= github.com/mattn/go-sqlite3 v1.14.9/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU= +github.com/mattn/go-sqlite3 v1.14.15/go.mod h1:2eHXhiwb8IkHr+BDWZGa96P6+rkvnG63S2DGjv9HUNg= +github.com/mattn/go-sqlite3 v1.14.16 h1:yOQRA0RpS5PFz/oikGwBEqvAWhWg5ufRz4ETLjwpU1Y= +github.com/mattn/go-sqlite3 v1.14.16/go.mod h1:2eHXhiwb8IkHr+BDWZGa96P6+rkvnG63S2DGjv9HUNg= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/rogpeppe/go-internal v1.6.1 h1:/FiVV8dS/e+YqF2JvO3yXRFbBLTIuSDkuC7aBOAvL+k= @@ -87,8 +92,13 @@ gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gorm.io/driver/sqlite v1.2.6 h1:SStaH/b+280M7C8vXeZLz/zo9cLQmIGwwj3cSj7p6l4= gorm.io/driver/sqlite v1.2.6/go.mod h1:gyoX0vHiiwi0g49tv+x2E7l8ksauLK0U/gShcdUsjWY= +gorm.io/driver/sqlite v1.4.4 h1:gIufGoR0dQzjkyqDyYSCvsYR6fba1Gw5YKDqKeChxFc= +gorm.io/driver/sqlite v1.4.4/go.mod h1:0Aq3iPO+v9ZKbcdiz8gLWRw5VOPcBOPUQJFLq5e2ecI= gorm.io/gorm v1.22.3/go.mod h1:F+OptMscr0P2F2qU97WT1WimdH9GaQPoDW7AYd5i2Y0= gorm.io/gorm v1.22.4 h1:8aPcyEJhY0MAt8aY6Dc524Pn+pO29K+ydu+e/cXSpQM= gorm.io/gorm v1.22.4/go.mod h1:1aeVC+pe9ZmvKZban/gW4QPra7PRoTEssyc922qCAkk= gorm.io/gorm v1.22.5 h1:lYREBgc02Be/5lSCTuysZZDb6ffL2qrat6fg9CFbvXU= gorm.io/gorm v1.22.5/go.mod h1:l2lP/RyAtc1ynaTjFksBde/O8v9oOGIApu2/xRitmZk= +gorm.io/gorm v1.24.0/go.mod h1:DVrVomtaYTbqs7gB/x2uVvqnXzv0nqjB396B8cG4dBA= +gorm.io/gorm v1.24.3 h1:WL2ifUmzR/SLp85CSURAfybcHnGZ+yLSGSxgYXlFBHg= +gorm.io/gorm v1.24.3/go.mod h1:DVrVomtaYTbqs7gB/x2uVvqnXzv0nqjB396B8cG4dBA= diff --git a/net/server/internal/api_addChannelTopic.go b/net/server/internal/api_addChannelTopic.go index 18a344a3..7a608c58 100644 --- a/net/server/internal/api_addChannelTopic.go +++ b/net/server/internal/api_addChannelTopic.go @@ -57,13 +57,13 @@ func AddChannelTopic(w http.ResponseWriter, r *http.Request) { topicSlot.Topic = topic // update parent revision - if res := tx.Model(&channelSlot.Channel).Update("topic_revision", act.ChannelRevision+1).Error; res != nil { + if res := tx.Model(&store.Channel{}).Where("id = ?", channelSlot.Channel.ID).Update("topic_revision", act.ChannelRevision+1).Error; res != nil { return res } - if res := tx.Model(&channelSlot).Update("revision", act.ChannelRevision+1).Error; res != nil { + if res := tx.Model(&store.ChannelSlot{}).Where("id = ?", channelSlot.ID).Update("revision", act.ChannelRevision+1).Error; res != nil { return res } - if res := tx.Model(act).Update("channel_revision", act.ChannelRevision+1).Error; res != nil { + if res := tx.Model(&store.Account{}).Where("id = ?", act.ID).Update("channel_revision", act.ChannelRevision+1).Error; res != nil { return res } return nil diff --git a/net/server/internal/api_setChannelRevision.go b/net/server/internal/api_setChannelRevision.go index 27ff8555..147a6df8 100644 --- a/net/server/internal/api_setChannelRevision.go +++ b/net/server/internal/api_setChannelRevision.go @@ -34,13 +34,13 @@ func NotifyChannelRevision(card *store.Card, revision int64) error { act := &card.Account err := store.DB.Transaction(func(tx *gorm.DB) error { - if res := tx.Model(card).Where("id = ?", card.ID).Update("notified_channel", revision).Error; res != nil { + if res := tx.Model(&store.Card{}).Where("id = ?", card.ID).Update("notified_channel", revision).Error; res != nil { return res } - if res := tx.Model(&card.CardSlot).Where("id = ?", card.CardSlot.ID).Update("revision", act.CardRevision+1).Error; res != nil { + if res := tx.Model(&store.CardSlot{}).Where("id = ?", card.CardSlot.ID).Update("revision", act.CardRevision+1).Error; res != nil { return res } - if res := tx.Model(act).Where("id = ?", act.ID).Update("card_revision", act.CardRevision+1).Error; res != nil { + if res := tx.Model(&store.Account{}).Where("id = ?", act.ID).Update("card_revision", act.CardRevision+1).Error; res != nil { return res } return nil