github.com/trigonella/mattermost-server@v5.11.1+incompatible/model/cluster_stats.go (about)

     1  // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
     2  // See License.txt for license information.
     3  
     4  package model
     5  
     6  import (
     7  	"encoding/json"
     8  	"io"
     9  )
    10  
    11  type ClusterStats struct {
    12  	Id                        string `json:"id"`
    13  	TotalWebsocketConnections int    `json:"total_websocket_connections"`
    14  	TotalReadDbConnections    int    `json:"total_read_db_connections"`
    15  	TotalMasterDbConnections  int    `json:"total_master_db_connections"`
    16  }
    17  
    18  func (me *ClusterStats) ToJson() string {
    19  	b, _ := json.Marshal(me)
    20  	return string(b)
    21  }
    22  
    23  func ClusterStatsFromJson(data io.Reader) *ClusterStats {
    24  	var me *ClusterStats
    25  	json.NewDecoder(data).Decode(&me)
    26  	return me
    27  }