MCPcopy Create free account
hub / github.com/GoSimplicity/LinkMe / decodeEventDataToPost

Function decodeEventDataToPost

internal/domain/events/es/process_util.go:142–159  ·  view source on GitHub ↗

decodeEventDataToPosts 解析事件数据为 Post 结构体

(data interface{}, posts *Post)

Source from the content-addressed store, hash-verified

140
141// decodeEventDataToPosts 解析事件数据为 Post 结构体
142func decodeEventDataToPost(data interface{}, posts *Post) error {
143 config := &mapstructure.DecoderConfig{
144 Result: posts,
145 TagName: "mapstructure",
146 WeaklyTypedInput: true,
147 DecodeHook: mapstructure.ComposeDecodeHookFunc(
148 stringToTimeHookFunc("2006-01-02 15:04:05.999"),
149 stringToNullTimeHookFunc("2006-01-02 15:04:05.999"),
150 ),
151 }
152
153 decoder, err := mapstructure.NewDecoder(config)
154 if err != nil {
155 return err
156 }
157
158 return decoder.Decode(data)
159}
160
161// decodeEventDataToUser 解析事件数据为 User 结构体
162func decodeEventDataToUser(data interface{}, users *User) error {

Callers 1

ConsumeMethod · 0.85

Calls 2

stringToTimeHookFuncFunction · 0.85
stringToNullTimeHookFuncFunction · 0.85

Tested by

no test coverage detected