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

     1  // Copyright (c) 2018-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 EmojiSearch struct {
    12  	Term       string `json:"term"`
    13  	PrefixOnly bool   `json:"prefix_only"`
    14  }
    15  
    16  func (es *EmojiSearch) ToJson() string {
    17  	b, _ := json.Marshal(es)
    18  	return string(b)
    19  }
    20  
    21  func EmojiSearchFromJson(data io.Reader) *EmojiSearch {
    22  	var es *EmojiSearch
    23  	json.NewDecoder(data).Decode(&es)
    24  	return es
    25  }