This commit is contained in:
Karmanyaah Malhotra
2021-02-21 22:46:17 -05:00
parent 7cb9983da8
commit f1c093896e
9 changed files with 311 additions and 279 deletions

View File

@ -44,6 +44,10 @@ func (pq *PuppetQuery) GetAll() (puppets []*Puppet) {
if ans.Error != nil || len(puppets) == 0 {
return nil
}
for _, puppet := range puppets {
puppet.db = pq.db
puppet.log = pq.log
}
// defer rows.Close()
// for rows.Next() {
// puppets = append(puppets, pq.New().Scan(rows))
@ -57,6 +61,8 @@ func (pq *PuppetQuery) Get(jid types.GroupMeID) *Puppet {
if ans.Error != nil || ans.RowsAffected == 0 {
return nil
}
puppet.db = pq.db
puppet.log = pq.log
return &puppet
}
@ -66,6 +72,8 @@ func (pq *PuppetQuery) GetByCustomMXID(mxid id.UserID) *Puppet {
if ans.Error != nil || ans.RowsAffected == 0 {
return nil
}
puppet.db = pq.db
puppet.log = pq.log
return &puppet
}
@ -75,6 +83,10 @@ func (pq *PuppetQuery) GetAllWithCustomMXID() (puppets []*Puppet) {
if ans.Error != nil || len(puppets) != 0 {
return nil
}
for _, puppet := range puppets {
puppet.db = pq.db
puppet.log = pq.log
}
// defer rows.Close()
// for rows.Next() {
// puppets = append(puppets, pq.New().Scan(rows))