github.com/gigforks/mattermost-server@v4.9.1-0.20180619094218-800d97fa55d0+incompatible/model/channel_search.go (about)

     1  // Copyright (c) 2016-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 ChannelSearch struct {
    12  	Term string `json:"term"`
    13  }
    14  
    15  // ToJson convert a Channel to a json string
    16  func (c *ChannelSearch) ToJson() string {
    17  	b, _ := json.Marshal(c)
    18  	return string(b)
    19  }
    20  
    21  // ChannelSearchFromJson will decode the input and return a Channel
    22  func ChannelSearchFromJson(data io.Reader) *ChannelSearch {
    23  	var cs *ChannelSearch
    24  	json.NewDecoder(data).Decode(&cs)
    25  	return cs
    26  }