github.com/rajatvaryani/mattermost-server@v5.11.1+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 const CHANNEL_SEARCH_DEFAULT_LIMIT = 50 12 13 type ChannelSearch struct { 14 Term string `json:"term"` 15 } 16 17 // ToJson convert a Channel to a json string 18 func (c *ChannelSearch) ToJson() string { 19 b, _ := json.Marshal(c) 20 return string(b) 21 } 22 23 // ChannelSearchFromJson will decode the input and return a Channel 24 func ChannelSearchFromJson(data io.Reader) *ChannelSearch { 25 var cs *ChannelSearch 26 json.NewDecoder(data).Decode(&cs) 27 return cs 28 }