diff options
author | Alex Auvolat <alex@adnab.me> | 2020-02-26 16:30:10 +0100 |
---|---|---|
committer | Alex Auvolat <alex@adnab.me> | 2020-02-26 16:30:10 +0100 |
commit | f3f1b8d981d818b38713fe84deb206720b0fcb10 (patch) | |
tree | 7fd0f5d3e71b3553a4c57db71cb01d2426075967 /db.go | |
parent | 67c7f7361d63a282788f159494a6f43172c8806a (diff) | |
download | easybridge-f3f1b8d981d818b38713fe84deb206720b0fcb10.tar.gz easybridge-f3f1b8d981d818b38713fe84deb206720b0fcb10.zip |
Room autorejoin
Diffstat (limited to 'db.go')
-rw-r--r-- | db.go | 16 |
1 files changed, 16 insertions, 0 deletions
@@ -36,6 +36,9 @@ func InitDb() error { db.AutoMigrate(&DbPmRoomMap{}) db.Model(&DbPmRoomMap{}).AddIndex("idx_protocol_user_account_user", "protocol", "user_id", "mx_user_id", "account_name") + db.AutoMigrate(&DbJoinedRoom{}) + db.Model(&DbJoinedRoom{}).AddIndex("idx_user_protocol_account", "mx_user_id", "protocol", "account_name") + return nil } @@ -86,6 +89,19 @@ type DbPmRoomMap struct { MxRoomID string `gorm:"index:mxroomoid"` } +// List of joined channels to be re-joined on reconnect +type DbJoinedRoom struct { + gorm.Model + + // User id and account name + MxUserID string + Protocol string + AccountName string + + // Room ID + RoomID connector.RoomID +} + // ---- Simple locking mechanism var dbLocks [256]sync.Mutex |