https://mattermost.atlassian.net/browse/MM-22051 ```release-note Removed the following methods/functions: (ad *AccessData) ToJson() (ar *AccessResponse) ToJson() (ar *AnalyticsRow) ToJson() (ar AnalyticsRows) ToJson() (o *Audit) ToJson() (o Audits) ToJson() (ad *AuthData) ToJson() (ar *AuthorizeRequest) ToJson() (o *ChannelPatch) ToJson() (o *ChannelsWithCount) ToJson() (o *ChannelCounts) ToJson() (o *ChannelData) ToJson() (o *ChannelMembers) ToJson() (o *ChannelUnread) ToJson() (o *ChannelUnreadAt) ToJson() (o *ChannelStats) ToJson() (o *ChannelView) ToJson() (o *ChannelViewResponse) ToJson() (o *ClusterDiscovery) ToJson() (ci *ClusterInfo) ToJson() (cs *ClusterStats) ToJson() (o *Command) ToJson() CommandListToJson(l []*Command) string (o *CommandArgs) ToJson() (cmr *CommandMoveRequest) ToJson() (o *CommandResponse) ToJson() (c *Compliance) ToJson() (c Compliances) ToJson() (o *Config) ToJson() EmojiListToJson(emojiList []*Emoji) ```
39 строки
830 B
Go
39 строки
830 B
Go
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
|
// See LICENSE.txt for license information.
|
|
|
|
package model
|
|
|
|
import (
|
|
"encoding/json"
|
|
"io"
|
|
)
|
|
|
|
type ClusterInfo struct {
|
|
Id string `json:"id"`
|
|
Version string `json:"version"`
|
|
ConfigHash string `json:"config_hash"`
|
|
IpAddress string `json:"ipaddress"`
|
|
Hostname string `json:"hostname"`
|
|
}
|
|
|
|
func ClusterInfoFromJson(data io.Reader) *ClusterInfo {
|
|
var ci *ClusterInfo
|
|
json.NewDecoder(data).Decode(&ci)
|
|
return ci
|
|
}
|
|
|
|
func ClusterInfosToJson(objmap []*ClusterInfo) string {
|
|
b, _ := json.Marshal(objmap)
|
|
return string(b)
|
|
}
|
|
|
|
func ClusterInfosFromJson(data io.Reader) []*ClusterInfo {
|
|
decoder := json.NewDecoder(data)
|
|
|
|
var objmap []*ClusterInfo
|
|
if err := decoder.Decode(&objmap); err != nil {
|
|
return make([]*ClusterInfo, 0)
|
|
}
|
|
return objmap
|
|
}
|