mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-12-16 03:13:11 -06:00
Fix nil may not be distinguished from empty slice in selectCurrentState
This commit is contained in:
parent
8049a55d49
commit
243a991011
|
|
@ -22,6 +22,12 @@ import (
|
||||||
// https://matrix.org/docs/spec/client_server/r0.3.0.html#post-matrix-client-r0-user-userid-filter
|
// https://matrix.org/docs/spec/client_server/r0.3.0.html#post-matrix-client-r0-user-userid-filter
|
||||||
// to SQL wildcards that can be used with LIKE()
|
// to SQL wildcards that can be used with LIKE()
|
||||||
func filterConvertTypeWildcardToSQL(values []string) []string {
|
func filterConvertTypeWildcardToSQL(values []string) []string {
|
||||||
|
if len(values) == 0 {
|
||||||
|
// Return nil instead of []string{} so IS NULL can work correctly when
|
||||||
|
// the return value is passed into SQL queries
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
ret := make([]string, len(values))
|
ret := make([]string, len(values))
|
||||||
for i := range values {
|
for i := range values {
|
||||||
ret[i] = strings.Replace(values[i], "*", "%", -1)
|
ret[i] = strings.Replace(values[i], "*", "%", -1)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue