1
0
Fork 0
mirror of https://github.com/eosswedenorg/thalos synced 2026-06-17 04:30:03 +02:00

internal/redis/namespace.go: Change delimiter to "::"

This commit is contained in:
Henrik Hautakoski 2023-01-12 14:59:32 +01:00
parent fb3ed0f976
commit dd9bd85801
3 changed files with 9 additions and 9 deletions

View file

@ -12,10 +12,10 @@ func TestKey_String(t *testing.T) {
fields fields
want string
}{
{"Empty", fields{NS: Namespace{}, Channel: Channel{}}, "ship.0000000000000000000000000000000000000000000000000000000000000000::"},
{"Transactions", fields{NS: Namespace{ChainID: "id"}, Channel: Channel{"transactions"}}, "ship.id::transactions"},
{"Nested", fields{NS: Namespace{ChainID: "id"}, Channel: Channel{"one.two"}}, "ship.id::one.two"},
{"Action", fields{NS: Namespace{ChainID: "id"}, Channel: ActionChannel{Contract: "mycontract"}}, "ship.id::actions.contract:mycontract"},
{"Empty", fields{NS: Namespace{}, Channel: Channel{}}, "ship::0000000000000000000000000000000000000000000000000000000000000000::"},
{"Transactions", fields{NS: Namespace{ChainID: "id"}, Channel: Channel{"transactions"}}, "ship::id::transactions"},
{"Nested", fields{NS: Namespace{ChainID: "id"}, Channel: Channel{"one.two"}}, "ship::id::one.two"},
{"Action", fields{NS: Namespace{ChainID: "id"}, Channel: ActionChannel{Contract: "mycontract"}}, "ship::id::actions.contract.mycontract"},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {

View file

@ -41,5 +41,5 @@ func (ns Namespace) String() string {
}
// Otherwise. return both.
return strings.Join([]string{ns.Prefix, ns.ChainID}, ".")
return strings.Join([]string{ns.Prefix, ns.ChainID}, "::")
}

View file

@ -8,10 +8,10 @@ func TestNamespace_String(t *testing.T) {
ns Namespace
want string
}{
{"Empty", Namespace{}, "ship.0000000000000000000000000000000000000000000000000000000000000000"},
{"Prefix Only", Namespace{Prefix: "some.prefix"}, "some.prefix.0000000000000000000000000000000000000000000000000000000000000000"},
{"ChainID Only", Namespace{ChainID: "1234"}, "ship.1234"},
{"Both", Namespace{Prefix: "my.prefix", ChainID: "1234"}, "my.prefix.1234"},
{"Empty", Namespace{}, "ship::0000000000000000000000000000000000000000000000000000000000000000"},
{"Prefix Only", Namespace{Prefix: "some.prefix"}, "some.prefix::0000000000000000000000000000000000000000000000000000000000000000"},
{"ChainID Only", Namespace{ChainID: "1234"}, "ship::1234"},
{"Both", Namespace{Prefix: "my.prefix", ChainID: "1234"}, "my.prefix::1234"},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {