topics

package
v0.0.0-...-b289748 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 7, 2024 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Topics

type Topics struct {
	// contains filtered or unexported fields
}

func NewTopics

func NewTopics(ta TopicsArgs) *Topics

func (*Topics) ChannelsForUser

func (t *Topics) ChannelsForUser(uid types.Uid) ([]string, error)

ChannelsForUser loads a slice of topic names where the user is a channel

reader and notifications (P) are enabled.

func (*Topics) Create

func (t *Topics) Create(topic *types.Topic) error

func (*Topics) CreateP2P

func (t *Topics) CreateP2P(initiator, invited *types.Subscription) error

CreateP2P given two users creates a p2p topic

func (*Topics) Delete

func (t *Topics) Delete(topic string, isChan, hard bool) error

Delete deletes specified topic.

func (*Topics) Get

func (t *Topics) Get(topic string) (*types.Topic, error)

Get loads a single topic by name, if it exists. If the topic does not exist the call returns (nil, nil)

func (*Topics) OwnTopics

func (t *Topics) OwnTopics(uid types.Uid) ([]string, error)

OwnTopics loads a slice of topic names where the user is the owner.

func (*Topics) Share

func (t *Topics) Share(shares []*types.Subscription) error

Share() creates topic subscriptions

func (*Topics) TopicsForUser

func (t *Topics) TopicsForUser(uid types.Uid, keepDeleted bool, opts *types.QueryOpt) ([]types.Subscription, error)

TopicsForUser loads user's contact list:

p2p and grp topics, except for 'me' & 'fnd' subscriptions.

Reads and denormalizes Public value.

func (*Topics) Update

func (t *Topics) Update(topic string, update map[string]any) error

Update() updates a topic record.

func (*Topics) UpdateOnMessage

func (t *Topics) UpdateOnMessage(topic string, msg *types.Message) error

UpdateOnMessage increments Topic's or User's SeqId value and updates TouchedAt timestamp.

func (*Topics) UpdateTopicOwner

func (t *Topics) UpdateTopicOwner(topic string, newOwner types.Uid) error

UpdateTopicOwner updates topic's owner

func (*Topics) UsersForTopic

func (t *Topics) UsersForTopic(topic string, keepDeleted bool, opts *types.QueryOpt) ([]types.Subscription, error)

UsersForTopic loads users subscribed to the given topic.

The difference between UsersForTopic vs SubsForTopic is that the former loads user.Public,

the latter does not.

type TopicsArgs

type TopicsArgs struct {
	DB     *pgxpool.Pool
	Utils  *utils.Utils
	Cfg    *config.StorePostgresConfig
	Shared *shared.Shared
	Logger *logger.Logger
	UGen   *types.UidGenerator
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL