-
Notifications
You must be signed in to change notification settings - Fork 17
/
text.go
45 lines (38 loc) · 1.09 KB
/
text.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
/*************************************************************************
* Copyright 2021 Gravwell, Inc. All rights reserved.
* Contact: <legal@gravwell.io>
*
* This software may be modified and distributed under the terms of the
* BSD 2-clause license. See the LICENSE file for details.
**************************************************************************/
package types
import (
"encoding/json"
)
type TextRequest struct {
BaseRequest
}
type TextResponse struct {
BaseResponse
Entries []SearchEntry `json:",omitempty"`
Explore []ExploreResult `json:",omitempty"`
}
type RawResponse struct {
BaseResponse
ContainsBinaryEntries bool //just a flag to tell the GUI that we might have data that needs some help
Entries []SearchEntry `json:",omitempty"`
Explore []ExploreResult `json:",omitempty"`
}
type RawRequest struct {
BaseRequest
}
func (tr TextResponse) MarshalJSON() ([]byte, error) {
type alias TextResponse
return json.Marshal(&struct {
alias
Entries emptyEntries
}{
alias: alias(tr),
Entries: emptyEntries(tr.Entries),
})
}