Save used keytoken in messages

This commit is contained in:
2023-05-27 18:51:20 +02:00
parent a0c72f5b94
commit 8826cb0312
8 changed files with 90 additions and 58 deletions

View File

@@ -40,6 +40,7 @@ type MessageFilter struct {
OnlyDeleted bool
IncludeDeleted bool
CompatAcknowledged *bool
UsedKeyID *[]KeyTokenID
}
func (f MessageFilter) SQL() (string, string, sq.PP, error) {
@@ -220,6 +221,15 @@ func (f MessageFilter) SQL() (string, string, sq.PP, error) {
}
}
if f.UsedKeyID != nil {
filter := make([]string, 0)
for i, v := range *f.UsedKeyID {
filter = append(filter, fmt.Sprintf("(used_key_id = :usedkeyid_%d)", i))
params[fmt.Sprintf("usedkeyid_%d", i)] = v
}
sqlClauses = append(sqlClauses, "("+strings.Join(filter, " OR ")+")")
}
if f.SearchString != nil {
filter := make([]string, 0)
for i, v := range *f.SearchString {