- Updated import paths for store packages to use specific types for better clarity and maintainability. - Refactored store initialization in the agent to utilize the new store types for Mongo, Redis, and Xun. - Removed deprecated store-related files to streamline the codebase and improve overall organization. - Ensured that all references to the store in the agent files are consistent with the new structure.
40 lines
697 B
Go
40 lines
697 B
Go
package xun
|
|
|
|
// Helper functions for type conversion
|
|
func getString(data map[string]interface{}, key string) string {
|
|
if v, ok := data[key].(string); ok {
|
|
return v
|
|
}
|
|
return ""
|
|
}
|
|
|
|
func getBool(data map[string]interface{}, key string) bool {
|
|
if v, ok := data[key].(bool); ok {
|
|
return v
|
|
}
|
|
return false
|
|
}
|
|
|
|
func getInt(data map[string]interface{}, key string) int {
|
|
switch v := data[key].(type) {
|
|
case int:
|
|
return v
|
|
case int64:
|
|
return int(v)
|
|
case float64:
|
|
return int(v)
|
|
}
|
|
return 0
|
|
}
|
|
|
|
func getInt64(data map[string]interface{}, key string) int64 {
|
|
switch v := data[key].(type) {
|
|
case int64:
|
|
return v
|
|
case int:
|
|
return int64(v)
|
|
case float64:
|
|
return int64(v)
|
|
}
|
|
return 0
|
|
}
|