4
0
mirror of https://github.com/cwinfo/matterbridge.git synced 2025-07-05 20:44:04 +00:00

Update dependencies/vendor (#1659)

This commit is contained in:
Wim
2021-12-12 00:05:15 +01:00
committed by GitHub
parent 658bdd9faa
commit 3893a035be
214 changed files with 8892 additions and 5650 deletions

View File

@ -6,6 +6,7 @@ package model
import (
"bytes"
"crypto/rand"
"database/sql/driver"
"encoding/base32"
"encoding/json"
"fmt"
@ -24,6 +25,7 @@ import (
"github.com/mattermost/mattermost-server/v6/shared/i18n"
"github.com/pborman/uuid"
"github.com/pkg/errors"
)
const (
@ -72,6 +74,30 @@ func (sa StringArray) Equals(input StringArray) bool {
return true
}
// Value converts StringArray to database value
func (sa StringArray) Value() (driver.Value, error) {
return json.Marshal(sa)
}
// Scan converts database column value to StringArray
func (sa *StringArray) Scan(value interface{}) error {
if value == nil {
return nil
}
buf, ok := value.([]byte)
if ok {
return json.Unmarshal(buf, sa)
}
str, ok := value.(string)
if ok {
return json.Unmarshal([]byte(str), sa)
}
return errors.New("received value is neither a byte slice nor string")
}
var translateFunc i18n.TranslateFunc
var translateFuncOnce sync.Once