From 3c46349abfdca4b7a4052e54487c04fe2e360315 Mon Sep 17 00:00:00 2001 From: Rustam Gilyazov <16064414+rusq@users.noreply.github.com> Date: Tue, 26 Mar 2024 22:38:41 +1000 Subject: [PATCH] omit always empty fields in search --- search.go | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/search.go b/search.go index b2f4e559b..d8623441f 100644 --- a/search.go +++ b/search.go @@ -36,11 +36,11 @@ type CtxChannel struct { } type CtxMessage struct { - User string `json:"user"` - Username string `json:"username"` - Text string `json:"text"` - Timestamp string `json:"ts"` - Type string `json:"type"` + User string `json:"user,omitempty"` + Username string `json:"username,omitempty"` + Text string `json:"text,omitempty"` + Timestamp string `json:"ts,omitempty"` + Type string `json:"type,omitempty"` } type SearchMessage struct { @@ -51,12 +51,12 @@ type SearchMessage struct { Timestamp string `json:"ts"` Blocks Blocks `json:"blocks,omitempty"` Text string `json:"text"` - Permalink string `json:"permalink"` - Attachments []Attachment `json:"attachments"` - Previous CtxMessage `json:"previous"` - Previous2 CtxMessage `json:"previous_2"` - Next CtxMessage `json:"next"` - Next2 CtxMessage `json:"next_2"` + Permalink string `json:"permalink,omitempty"` + Attachments []Attachment `json:"attachments,omitempty"` + Previous CtxMessage `json:"previous,omitempty"` + Previous2 CtxMessage `json:"previous_2,omitempty"` + Next CtxMessage `json:"next,omitempty"` + Next2 CtxMessage `json:"next_2,omitempty"` } type SearchMessages struct {