mirror of
https://github.com/eosswedenorg/thalos
synced 2026-06-16 04:24:56 +02:00
transport/channel.go: Adding Channel.Is()
This commit is contained in:
parent
7358bebc76
commit
8e99146cc2
1 changed files with 15 additions and 0 deletions
|
|
@ -20,6 +20,21 @@ func (c Channel) String() string {
|
|||
return strings.Join(c, "/")
|
||||
}
|
||||
|
||||
// Check if two channels are equal
|
||||
func (c Channel) Is(other Channel) bool {
|
||||
if len(c) != len(other) {
|
||||
return false
|
||||
}
|
||||
|
||||
for i, item := range c {
|
||||
if item != other[i] {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// Define channels without any variables.
|
||||
var (
|
||||
TransactionChannel = Channel{"transaction"}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue