mirror of
https://github.com/nbd-wtf/go-nostr.git
synced 2025-08-28 06:41:53 +02:00
style: using effective go and refactoring
This commit is contained in:
8
tags.go
8
tags.go
@@ -12,10 +12,15 @@ type Tag []string
|
||||
|
||||
// StartsWith checks if a tag contains a prefix.
|
||||
// for example,
|
||||
//
|
||||
// ["p", "abcdef...", "wss://relay.com"]
|
||||
//
|
||||
// would match against
|
||||
//
|
||||
// ["p", "abcdef..."]
|
||||
//
|
||||
// or even
|
||||
//
|
||||
// ["p", "abcdef...", "wss://"]
|
||||
func (tag Tag) StartsWith(prefix []string) bool {
|
||||
prefixLen := len(prefix)
|
||||
@@ -109,9 +114,8 @@ func (tags Tags) AppendUnique(tag Tag) Tags {
|
||||
|
||||
if tags.GetFirst(tag[:n]) == nil {
|
||||
return append(tags, tag)
|
||||
} else {
|
||||
return tags
|
||||
}
|
||||
return tags
|
||||
}
|
||||
|
||||
func (t *Tags) Scan(src any) error {
|
||||
|
Reference in New Issue
Block a user