@@ -61,3 +61,49 @@ func convertRedisHashToSession(hash map[string]string) SessionStreamData {
6161
6262 return session
6363}
64+
65+ // /* build transaction stream data from a map */
66+ // func buildTransactionStreamDataFromMap(data map[string]interface{}) (TransactionStreamData, error) {
67+ // entriesRaw, _ := data["entries"].([]interface{})
68+ // entries := make([]ACLEntryStream, 0, len(entriesRaw))
69+ // for _, e := range entriesRaw {
70+ // if entryMap, ok := e.(map[string]interface{}); ok {
71+ // entry := ACLEntryStream{
72+ // EntityType: fmt.Sprintf("%v", entryMap["entityType"]),
73+ // Entity: fmt.Sprintf("%v", entryMap["entity"]),
74+ // Permissions: fmt.Sprintf("%v", entryMap["permissions"]),
75+ // Action: fmt.Sprintf("%v", entryMap["action"]),
76+ // Success: entryMap["success"] == true,
77+ // Error: fmt.Sprintf("%v", entryMap["error"]),
78+ // }
79+ // entries = append(entries, entry)
80+ // }
81+ // }
82+
83+ // var timestamp time.Time
84+ // if t, err := time.Parse(time.RFC3339, data["timestamp"].(string)); err == nil {
85+ // timestamp = t
86+ // }
87+
88+ // return TransactionStreamData{
89+ // ID: fmt.Sprintf("%v", data["id"]),
90+ // SessionID: fmt.Sprintf("%v", data["sessionId"]),
91+ // Timestamp: timestamp,
92+ // Operation: fmt.Sprintf("%v", data["operation"]),
93+ // TargetPath: fmt.Sprintf("%v", data["targetPath"]),
94+ // Entries: entries,
95+ // Status: fmt.Sprintf("%v", data["status"]),
96+ // ErrorMsg: fmt.Sprintf("%v", data["errorMsg"]),
97+ // Output: fmt.Sprintf("%v", data["output"]),
98+ // ExecutedBy: fmt.Sprintf("%v", data["executedBy"]),
99+ // DurationMs: int64(mustFloat64(data["durationMs"])),
100+ // }, nil
101+ // }
102+
103+ // /* returns if value is of float type */
104+ // func mustFloat64(val interface{}) float64 {
105+ // if f, ok := val.(float64); ok {
106+ // return f
107+ // }
108+ // return 0
109+ // }
0 commit comments