sdk: EraseAccessTime and EraseEventRelays.
This commit is contained in:
@@ -49,3 +49,8 @@ func (sys *System) GetEventAccessTime(id nostr.ID) nostr.Timestamp {
|
|||||||
|
|
||||||
return decodeEventAccessTime(data)
|
return decodeEventAccessTime(data)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (sys *System) EraseAccessTime(id nostr.ID) error {
|
||||||
|
key := makeEventAccessTimeKey(id)
|
||||||
|
return sys.KVStore.Delete(key)
|
||||||
|
}
|
||||||
|
|||||||
@@ -104,18 +104,20 @@ func (sys *System) trackEventRelay(id nostr.ID, relay string, onlyIfItExists boo
|
|||||||
|
|
||||||
// GetEventRelays returns all known relay URLs an event is known to be available on.
|
// GetEventRelays returns all known relay URLs an event is known to be available on.
|
||||||
// It is based on information kept on KVStore.
|
// It is based on information kept on KVStore.
|
||||||
func (sys *System) GetEventRelays(id nostr.ID) ([]string, error) {
|
func (sys *System) GetEventRelays(id nostr.ID) []string {
|
||||||
// get the key for this event
|
// get the key for this event
|
||||||
key := makeEventRelayKey(id)
|
key := makeEventRelayKey(id)
|
||||||
|
|
||||||
// get stored relay list
|
// get stored relay list
|
||||||
data, err := sys.KVStore.Get(key)
|
data, _ := sys.KVStore.Get(key)
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
if data == nil {
|
if data == nil {
|
||||||
return nil, nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
return decodeRelayList(data), nil
|
return decodeRelayList(data)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (sys *System) EraseEventRelays(id nostr.ID) error {
|
||||||
|
key := makeEventRelayKey(id)
|
||||||
|
return sys.KVStore.Delete(key)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user