Documentation ¶
Index ¶
- func ClearRelay(c *RelayConnection)
- func ConnectRelay(c *RelayConnection) error
- func ExtTagValue(tags nostr.Tags) []string
- func FilterTag(e *nostr.Event, tag string) nostr.Tags
- func FilterTagWithCond(tags nostr.Tags, conditions map[int]string) nostr.Tags
- func GetEventsByAuthor(kinds []int, authors []domain.UserPubKey, options domain.PagingOptions) []*nostr.Event
- func GetEventsFromString(c StringCacheMap, key string) []*nostr.Event
- func ManageEventsFromString(c StringCacheMap, key string, supplier func() []*nostr.Event) []*nostr.Event
- func PrintConnectionError(c *RelayConnection, err error)
- func QuerySyncAll(ctx context.Context, filters nostr.Filters) []*nostr.Event
- func QuerySyncAllWithOptions(ctx context.Context, filters nostr.Filters, options QueryOptions) []*nostr.Event
- func SentEventAll(ctx context.Context, event nostr.Event) bool
- func SetEventsFromString(c StringCacheMap, key string, v []*nostr.Event)
- func SleepTimeSpan(c *RelayConnection)
- func StartAllRelayServers(urls []string)
- func StartRelayServer(url string)
- type Event
- type PostEvent
- type QueryOptions
- type ReactionEvent
- type RelayConnection
- type RelayEventsCache
- type RelayPostRepository
- func (r *RelayPostRepository) GetPost(id domain.PostID) (*domain.Post, error)
- func (r *RelayPostRepository) GetPosts(pks []domain.UserPubKey, options domain.PagingOptions) ([]domain.Post, error)
- func (r *RelayPostRepository) GetPublicPosts(options domain.PagingOptions) ([]domain.Post, error)
- func (r *RelayPostRepository) GetReplies(id domain.PostID) ([]domain.Post, error)
- func (r *RelayPostRepository) GetUserLatestPosts(pk domain.UserPubKey) ([]domain.Post, error)
- func (r *RelayPostRepository) SendPost(pk domain.UserPubKey, sk domain.UserSecretKey, text string) error
- type RelayReactionRepository
- type RelayRelationShipRepository
- type RelayRepostRepository
- type RelayTimelineRepository
- type RelayUserRepository
- type RepostEvent
- type StringCacheMap
- type UserEvent
- type UserEventCache
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ClearRelay ¶
func ClearRelay(c *RelayConnection)
func ConnectRelay ¶
func ConnectRelay(c *RelayConnection) error
func ExtTagValue ¶
func ExtTagValue( tags nostr.Tags, ) []string
func FilterTagWithCond ¶
ExtractTagWithCond
func GetEventsByAuthor ¶
func GetEventsByAuthor( kinds []int, authors []domain.UserPubKey, options domain.PagingOptions, ) []*nostr.Event
func GetEventsFromString ¶
func GetEventsFromString( c StringCacheMap, key string, ) []*nostr.Event
GetEventsFromString
func ManageEventsFromString ¶
func ManageEventsFromString( c StringCacheMap, key string, supplier func() []*nostr.Event, ) []*nostr.Event
ManageEventsFromString
func PrintConnectionError ¶
func PrintConnectionError(c *RelayConnection, err error)
func QuerySyncAll ¶
QuerySyncAll Query all relay servers and retrieve results synchronously
func QuerySyncAllWithOptions ¶
func QuerySyncAllWithOptions( ctx context.Context, filters nostr.Filters, options QueryOptions, ) []*nostr.Event
QuerySyncAllWithOptions Query all relay servers and retrieve results synchronously
func SetEventsFromString ¶
func SetEventsFromString( c StringCacheMap, key string, v []*nostr.Event, )
SetEventsFromString
func SleepTimeSpan ¶
func SleepTimeSpan(c *RelayConnection)
func StartAllRelayServers ¶
func StartAllRelayServers(urls []string)
StartAllRelayServers Connect to all relay servers.
Types ¶
type PostEvent ¶
type PostEvent struct { Event RootPostID *string ReplyPostID *string MentionedUserPubKeys []string }
func MarshalPostEvent ¶
type QueryOptions ¶
type QueryOptions struct { RequiredOneEvent bool ExpectedEventCount int ExpectedEOSECount int TimeoutSeconds time.Duration }
func DefaultQueryOptions ¶
func DefaultQueryOptions() QueryOptions
type ReactionEvent ¶
func MarshalReactionEvent ¶
func MarshalReactionEvent(e *nostr.Event) (*ReactionEvent, error)
func (*ReactionEvent) ToReaction ¶
func (e *ReactionEvent) ToReaction() domain.Reaction
type RelayConnection ¶
type RelayConnection struct { URL string Relay *nostr.Relay Context *context.Context Cancel *context.CancelFunc WaitSpan time.Duration Error chan error }
func GetConnections ¶
func GetConnections() []*RelayConnection
GetConnections Obtain relay server connection information
type RelayEventsCache ¶
type RelayEventsCache struct { Events []*nostr.Event ExpiredAt int64 }
type RelayPostRepository ¶
type RelayPostRepository struct { LatestPostCache StringCacheMap GetRepliesCache StringCacheMap }
func NewRelayPostRepository ¶
func NewRelayPostRepository() *RelayPostRepository
NewRelayPostRepository Create a new post repository
func (*RelayPostRepository) GetPosts ¶
func (r *RelayPostRepository) GetPosts( pks []domain.UserPubKey, options domain.PagingOptions, ) ([]domain.Post, error)
GetPosts
func (*RelayPostRepository) GetPublicPosts ¶
func (r *RelayPostRepository) GetPublicPosts( options domain.PagingOptions, ) ([]domain.Post, error)
GetPublicPosts
func (*RelayPostRepository) GetReplies ¶
GetReplies
func (*RelayPostRepository) GetUserLatestPosts ¶
func (r *RelayPostRepository) GetUserLatestPosts( pk domain.UserPubKey, ) ([]domain.Post, error)
GetUserLatestPosts
func (*RelayPostRepository) SendPost ¶
func (r *RelayPostRepository) SendPost( pk domain.UserPubKey, sk domain.UserSecretKey, text string, ) error
SendPost
type RelayReactionRepository ¶
type RelayReactionRepository struct {
Cache StringCacheMap
}
func NewRelayReactionRepository ¶
func NewRelayReactionRepository() *RelayReactionRepository
NewRelayReactionRepository Create a new post repository
func (RelayReactionRepository) GetReactions ¶
type RelayRelationShipRepository ¶
type RelayRelationShipRepository struct { FollowingsCache StringCacheMap FollowersCache StringCacheMap }
func NewRelayRelationShipRepository ¶
func NewRelayRelationShipRepository() *RelayRelationShipRepository
NewRelayRelationShipRepository Create a new relay relationship repository
func (*RelayRelationShipRepository) GetFollowers ¶
func (r *RelayRelationShipRepository) GetFollowers( pk domain.UserPubKey, ) ([]domain.UserPubKey, error)
GetFollowers Get public keys of users specific user is followed by
func (*RelayRelationShipRepository) GetFollowings ¶
func (r *RelayRelationShipRepository) GetFollowings( pk domain.UserPubKey, ) ([]domain.UserPubKey, error)
GetFollowings Get public keys of users specific user is following
type RelayRepostRepository ¶
type RelayRepostRepository struct {
Cache StringCacheMap
}
func NewRelayRepostRepository ¶
func NewRelayRepostRepository() *RelayRepostRepository
NewRelayRepostRepository Create a new post repository
func (RelayRepostRepository) GetReposts ¶
type RelayTimelineRepository ¶
type RelayTimelineRepository struct { }
func NewRelayTimelineRepository ¶
func NewRelayTimelineRepository() *RelayTimelineRepository
NewRelayTimelineRepository Create a new timeline repository
func (*RelayTimelineRepository) GetTimelines ¶
func (r *RelayTimelineRepository) GetTimelines( pks []domain.UserPubKey, options domain.PagingOptions, ) ([]domain.Timeline, error)
GetTimelines
type RelayUserRepository ¶
type RelayUserRepository struct {
Cache *lru.Cache[domain.UserPubKey, *UserEventCache]
}
func NewRelayUserRepository ¶
func NewRelayUserRepository() *RelayUserRepository
NewRelayUserRepository Create a new relay user repository
func (*RelayUserRepository) GetUserFromCache ¶
func (r *RelayUserRepository) GetUserFromCache( pk domain.UserPubKey, ) *domain.User
GetUserFromCache Retrieve user information from cached data
func (*RelayUserRepository) GetUsers ¶
func (r *RelayUserRepository) GetUsers( pks []domain.UserPubKey, ) ([]domain.User, error)
GetUsers Retrieve user information
func (*RelayUserRepository) SetUserCache ¶
func (r *RelayUserRepository) SetUserCache( pk domain.UserPubKey, event *UserEvent, )
type RepostEvent ¶
func MarshalRepostEvent ¶
func MarshalRepostEvent(e *nostr.Event) (*RepostEvent, error)
func (*RepostEvent) ToRepost ¶
func (e *RepostEvent) ToRepost() domain.Repost
type StringCacheMap ¶
type StringCacheMap = *lru.Cache[string, *RelayEventsCache]
func NewStringCacheMap ¶
func NewStringCacheMap(size int) StringCacheMap
type UserEvent ¶
type UserEvent struct { Event Name string `json:"name"` DisplayName string `json:"display_name"` About string `json:"about"` Picture string `json:"picture"` Banner string `json:"banner"` Website string `json:"website"` Lud06 string `json:"lud06"` }