-
Notifications
You must be signed in to change notification settings - Fork 2
/
query_result.go
35 lines (30 loc) · 943 Bytes
/
query_result.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
package admin
import (
"fmt"
"git.oschina.net/cloudzone/smartgo/stgcommon/message"
"strings"
)
type QueryResult struct {
IndexLastUpdateTimestamp int64
MessageList []*message.MessageExt
}
func NewQueryResult(indexLastUpdateTimestamp int64, messageList []*message.MessageExt) *QueryResult {
queryResult := &QueryResult{
IndexLastUpdateTimestamp: indexLastUpdateTimestamp,
MessageList: messageList,
}
return queryResult
}
func (self *QueryResult) ToString() string {
if self == nil {
return "QueryResult is nil"
}
msgInfos := make([]string, 0)
if self.MessageList != nil && len(self.MessageList) > 0 {
for _, msg := range self.MessageList {
msgInfos = append(msgInfos, msg.ToString())
}
}
format := "QueryResult {IndexLastUpdateTimestamp=%d, MessageList=[%s] }"
return fmt.Sprintf(format, self.IndexLastUpdateTimestamp, strings.Join(msgInfos, ","))
}