-
Notifications
You must be signed in to change notification settings - Fork 0
/
message.go
67 lines (55 loc) · 913 Bytes
/
message.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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
package key
import (
"fmt"
"strconv"
"github.com/venturemark/apicommon/pkg/metadata"
)
// Message is the storage key for mapping message IDs. A message can have
// multiple replies, which are just messages as well.
func Message(m map[string]string) *Key {
var mei string
{
mei = m[metadata.MessageID]
}
var tii string
{
tii = m[metadata.TimelineID]
}
var upi string
{
upi = m[metadata.UpdateID]
}
var vei string
{
vei = m[metadata.VentureID]
}
var k *Key
{
var id *ID
if mei != "" {
f, err := strconv.ParseFloat(mei, 64)
if err != nil {
panic(err)
}
s := mei
id = &ID{
f: f,
s: s,
}
}
var ele string
{
ele = fmt.Sprintf("ven:%s:tim:%s:upd:%s:mes:%s", vei, tii, upi, mei)
}
var lis string
{
lis = fmt.Sprintf("ven:%s:tim:%s:upd:%s:mes", vei, tii, upi)
}
k = &Key{
id: id,
ele: ele,
lis: lis,
}
}
return k
}