5
0
mirror of https://github.com/cwinfo/matterbridge.git synced 2024-09-20 14:52:30 +00:00
matterbridge/vendor/github.com/mattermost/mattermost-server/v5/model/audits.go
Wim 4dd8bae5c9
Update dependencies (#1610)
* Update dependencies

* Update module to go 1.17
2021-10-17 00:47:22 +02:00

34 lines
554 B
Go

// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
package model
import (
"encoding/json"
"io"
)
type Audits []Audit
func (o Audits) Etag() string {
if len(o) > 0 {
// the first in the list is always the most current
return Etag(o[0].CreateAt)
}
return ""
}
func (o Audits) ToJson() string {
b, err := json.Marshal(o)
if err != nil {
return "[]"
}
return string(b)
}
func AuditsFromJson(data io.Reader) Audits {
var o Audits
json.NewDecoder(data).Decode(&o)
return o
}