-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat!(prj): add view message and modify search msg indexing model
- Loading branch information
Showing
10 changed files
with
113 additions
and
73 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,29 @@ | ||
package models | ||
|
||
import ( | ||
"encoding/json" | ||
) | ||
|
||
type SearchMsg struct { | ||
ID string `json:"id" mapstructure:"id"` // message id | ||
Chat string `json:"chat" mapstructure:"chat"` // chat id | ||
ChatName string `json:"chat_name" mapstructure:"chat_name"` // chat name | ||
Text string `json:"text" mapstructure:"text"` // text content | ||
Sender string `json:"sender" mapstructure:"sender"` // sender id | ||
SenderName string `json:"sender_name" mapstructure:"sender_name"` // sender name | ||
Date string `json:"date" mapstructure:"date"` // unix timestamp | ||
ID int `json:"id,string" mapstructure:"id" index:"id"` // message id | ||
Chat int64 `json:"chat,string" mapstructure:"chat" index:"chat"` // chat id | ||
ChatName string `json:"chat_name" mapstructure:"chat_name" index:"chat_name"` // chat name | ||
Text string `json:"text" mapstructure:"text" index:"text"` // text content | ||
Sender int64 `json:"sender,string" mapstructure:"sender" index:"sender"` // sender id | ||
SenderName string `json:"sender_name" mapstructure:"sender_name" index:"sender_name"` // sender name | ||
Date int64 `json:"date,string" mapstructure:"date" index:"date"` // unix timestamp | ||
} | ||
|
||
func (m *SearchMsg) Encode() (map[string]string, error) { | ||
b, err := json.Marshal(m) | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
mm := make(map[string]string) | ||
if err = json.Unmarshal(b, &mm); err != nil { | ||
return nil, err | ||
} | ||
|
||
return mm, nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters