From dd9bd8580116fa397388b1d1eee79987c360105a Mon Sep 17 00:00:00 2001 From: Henrik Hautakoski Date: Thu, 12 Jan 2023 14:59:32 +0100 Subject: [PATCH] internal/redis/namespace.go: Change delimiter to "::" --- internal/redis/key_test.go | 8 ++++---- internal/redis/namespace.go | 2 +- internal/redis/namespace_test.go | 8 ++++---- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/internal/redis/key_test.go b/internal/redis/key_test.go index caaf34e..2fe05a3 100644 --- a/internal/redis/key_test.go +++ b/internal/redis/key_test.go @@ -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) { diff --git a/internal/redis/namespace.go b/internal/redis/namespace.go index 4c6cd39..1fbb88d 100644 --- a/internal/redis/namespace.go +++ b/internal/redis/namespace.go @@ -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}, "::") } diff --git a/internal/redis/namespace_test.go b/internal/redis/namespace_test.go index 1890c0e..bb52b92 100644 --- a/internal/redis/namespace_test.go +++ b/internal/redis/namespace_test.go @@ -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) {