@@ -38,7 +38,7 @@ func (uq *UserQuery) New() *User {
38
38
}
39
39
40
40
func (uq * UserQuery ) GetAll () (users []* User ) {
41
- rows , err := uq .db .Query (`SELECT mxid, username, agent, device, management_room FROM "user"` )
41
+ rows , err := uq .db .Query (`SELECT mxid, username, agent, device, management_room, space_room FROM "user"` )
42
42
if err != nil || rows == nil {
43
43
return nil
44
44
}
@@ -50,15 +50,15 @@ func (uq *UserQuery) GetAll() (users []*User) {
50
50
}
51
51
52
52
func (uq * UserQuery ) GetByMXID (userID id.UserID ) * User {
53
- row := uq .db .QueryRow (`SELECT mxid, username, agent, device, management_room FROM "user" WHERE mxid=$1` , userID )
53
+ row := uq .db .QueryRow (`SELECT mxid, username, agent, device, management_room, space_room FROM "user" WHERE mxid=$1` , userID )
54
54
if row == nil {
55
55
return nil
56
56
}
57
57
return uq .New ().Scan (row )
58
58
}
59
59
60
60
func (uq * UserQuery ) GetByUsername (username string ) * User {
61
- row := uq .db .QueryRow (`SELECT mxid, username, agent, device, management_room FROM "user" WHERE username=$1` , username )
61
+ row := uq .db .QueryRow (`SELECT mxid, username, agent, device, management_room, space_room FROM "user" WHERE username=$1` , username )
62
62
if row == nil {
63
63
return nil
64
64
}
@@ -78,7 +78,7 @@ type User struct {
78
78
func (user * User ) Scan (row Scannable ) * User {
79
79
var username sql.NullString
80
80
var device , agent sql.NullByte
81
- err := row .Scan (& user .MXID , & username , & agent , & device , & user .ManagementRoom )
81
+ err := row .Scan (& user .MXID , & username , & agent , & device , & user .ManagementRoom , & user . SpaceRoom )
82
82
if err != nil {
83
83
if err != sql .ErrNoRows {
84
84
user .log .Errorln ("Database scan failed:" , err )
@@ -113,16 +113,16 @@ func (user *User) devicePtr() *uint8 {
113
113
}
114
114
115
115
func (user * User ) Insert () {
116
- _ , err := user .db .Exec (`INSERT INTO "user" (mxid, username, agent, device, management_room) VALUES ($1, $2, $3, $4, $5)` ,
117
- user .MXID , user .usernamePtr (), user .agentPtr (), user .devicePtr (), user .ManagementRoom )
116
+ _ , err := user .db .Exec (`INSERT INTO "user" (mxid, username, agent, device, management_room, space_room ) VALUES ($1, $2, $3, $4, $5, $6 )` ,
117
+ user .MXID , user .usernamePtr (), user .agentPtr (), user .devicePtr (), user .ManagementRoom , user . SpaceRoom )
118
118
if err != nil {
119
119
user .log .Warnfln ("Failed to insert %s: %v" , user .MXID , err )
120
120
}
121
121
}
122
122
123
123
func (user * User ) Update () {
124
- _ , err := user .db .Exec (`UPDATE "user" SET username=$1, agent=$2, device=$3, management_room=$4 WHERE mxid=$5 ` ,
125
- user .usernamePtr (), user .agentPtr (), user .devicePtr (), user .ManagementRoom , user .MXID )
124
+ _ , err := user .db .Exec (`UPDATE "user" SET username=$1, agent=$2, device=$3, management_room=$4, space_room=$5 WHERE mxid=$6 ` ,
125
+ user .usernamePtr (), user .agentPtr (), user .devicePtr (), user .ManagementRoom , user .SpaceRoom , user . MXID )
126
126
if err != nil {
127
127
user .log .Warnfln ("Failed to update %s: %v" , user .MXID , err )
128
128
}
0 commit comments