mongowrapper

package
v0.0.0-...-19a598b Latest Latest
Warning

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

Go to latest
Published: May 9, 2022 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Datastore

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

Datastore wraps the MongoDB client and handles MongoDB operations.

func NewDatastore

func NewDatastore(client *mongo.Client, database string, server *url.URL) (*Datastore, error)

NewDatastore returns an initialized Datastore which handles MongoDB operations.

func (*Datastore) AddActivityToActivities

func (d *Datastore) AddActivityToActivities(ctx context.Context, activity vocab.Type, objectID primitive.ObjectID) error

func (*Datastore) AddActivityToActorInbox

func (d *Datastore) AddActivityToActorInbox(ctx context.Context, activity vocab.Type, username string, inReplyTo *url.URL) error

func (*Datastore) AddActivityToOutbox

func (d *Datastore) AddActivityToOutbox(ctx context.Context, activity vocab.Type, username string) error

func (*Datastore) AddActivityToPublicInbox

func (d *Datastore) AddActivityToPublicInbox(ctx context.Context, activity vocab.Type, objectID primitive.ObjectID, isReply bool) error

func (*Datastore) AddActorToFollows

func (d *Datastore) AddActorToFollows(ctx context.Context, actorID, followerID string) error

AddActorToFollows adds the Actor ID to the Follower ID specified.

func (*Datastore) AddFollowerToActor

func (d *Datastore) AddFollowerToActor(ctx context.Context, actorID, followerID string) error

AddFollowerToActor adds the Follower ID to the Actor ID.

func (*Datastore) AddHostToSameInstitute

func (d *Datastore) AddHostToSameInstitute(ctx context.Context, instance *url.URL) error

func (*Datastore) AddObjectsToActorInbox

func (d *Datastore) AddObjectsToActorInbox(ctx context.Context, objects []vocab.Type, userID string) error

func (*Datastore) AddReplyToActivity

func (d *Datastore) AddReplyToActivity(ctx context.Context, object vocab.Type, inReplyTo *url.URL) error

func (*Datastore) CreateUser

func (d *Datastore) CreateUser(ctx context.Context, user *user.User) error

func (*Datastore) DeleteObjectFromAllInboxes

func (d *Datastore) DeleteObjectFromAllInboxes(ctx context.Context, objectID *url.URL) error

func (*Datastore) DeleteObjectFromInbox

func (d *Datastore) DeleteObjectFromInbox(ctx context.Context, objectID *url.URL) error

func (*Datastore) DeleteObjectFromPublicInbox

func (d *Datastore) DeleteObjectFromPublicInbox(ctx context.Context, objectID *url.URL) error

func (*Datastore) GetActivityByActivityID

func (d *Datastore) GetActivityByActivityID(ctx context.Context, activityID string) (activity.Activity, error)

func (*Datastore) GetActivityByObjectID

func (d *Datastore) GetActivityByObjectID(ctx context.Context, activityID, baseURL string) (activity.Activity, error)

func (*Datastore) GetActorByActorID

func (d *Datastore) GetActorByActorID(ctx context.Context, actorID string) (actor.Person, error)

GetActorByActorID returns an instance of Person from Mongo using URI.

func (*Datastore) GetActorByUsername

func (d *Datastore) GetActorByUsername(ctx context.Context, username string) (vocab.ActivityStreamsPerson, error)

GetActorByUsername returns an instance of Person from Mongo using Username.

func (*Datastore) GetActorInbox

func (d *Datastore) GetActorInbox(ctx context.Context, username, minID, maxID string, local bool) (vocab.ActivityStreamsOrderedCollectionPage, error)

GetActorInbox paginates the inbox 20 activities at a time using IDs. ObjectIDs exceeding that maxID are ignored, and ObjectIDs under the min ID are ignored.

func (*Datastore) GetActorInboxAsOrderedCollection

func (d *Datastore) GetActorInboxAsOrderedCollection(ctx context.Context, username string, local bool) (vocab.ActivityStreamsOrderedCollection, error)

func (*Datastore) GetActorOutbox

func (d *Datastore) GetActorOutbox(ctx context.Context, username, minID, maxID string) (vocab.ActivityStreamsOrderedCollectionPage, error)

GetActorOutbox paginates the inbox 20 activities at a time using IDs. ObjectIDs exceeding that maxID are ignored, and ObjectIDs under the min ID are ignored.

func (*Datastore) GetActorOutboxAsOrderedCollection

func (d *Datastore) GetActorOutboxAsOrderedCollection(ctx context.Context, username string) (vocab.ActivityStreamsOrderedCollection, error)

func (*Datastore) GetAnnounceStatus

func (d *Datastore) GetAnnounceStatus(ctx context.Context, actorID, objectID *url.URL) (bool, error)

func (*Datastore) GetEventInbox

func (d *Datastore) GetEventInbox(ctx context.Context, username, minID, maxID string) (vocab.ActivityStreamsOrderedCollectionPage, error)

GetEventInbox paginates the inbox 20 activities at a time using IDs. ObjectIDs exceeding that maxID are ignored, and ObjectIDs under the min ID are ignored.

func (*Datastore) GetEventInboxAsOrderedCollection

func (d *Datastore) GetEventInboxAsOrderedCollection(ctx context.Context, username string) (vocab.ActivityStreamsOrderedCollection, error)

GetEventInboxAsOrderedCollection returns an OrderedCollection of invites. This method returns events that have yet to take place.

func (*Datastore) GetFollowerStatus

func (d *Datastore) GetFollowerStatus(ctx context.Context, followerID, followedID string) (int, error)

func (*Datastore) GetFollowersByUsername

func (d *Datastore) GetFollowersByUsername(ctx context.Context, username string) (vocab.ActivityStreamsOrderedCollection, error)

GetFollowersByUsername returns an OrderedCollection of Follower IDs.

func (*Datastore) GetFollowingByUsername

func (d *Datastore) GetFollowingByUsername(ctx context.Context, username string) (vocab.ActivityStreamsOrderedCollection, error)

GetFollowingByUsername returns an OrderedCollection of Following IDs.

func (*Datastore) GetLikeStatus

func (d *Datastore) GetLikeStatus(ctx context.Context, actorID, objectID *url.URL) (bool, error)

func (*Datastore) GetLikedAsOrderedCollection

func (d *Datastore) GetLikedAsOrderedCollection(ctx context.Context, username string) (vocab.ActivityStreamsOrderedCollection, error)

GetLikedAsOrderedCollection returns an OrderedCollection of Like Activities.

func (*Datastore) GetLikesAsOrderedCollection

func (d *Datastore) GetLikesAsOrderedCollection(ctx context.Context, activityID *url.URL) (vocab.ActivityStreamsOrderedCollection, error)

GetLikesAsOrderedCollection returns all known likes of an ObjectID.

func (*Datastore) GetLikesUsingObjectID

func (d *Datastore) GetLikesUsingObjectID(ctx context.Context, activityID string) (vocab.ActivityStreamsOrderedCollection, error)

GetLikesUsingObjectID returns an OrderedCollection of Like Activities.

func (*Datastore) GetNotificationsInbox

func (d *Datastore) GetNotificationsInbox(ctx context.Context, username, minID, maxID string) (vocab.ActivityStreamsOrderedCollectionPage, error)

GetNotificationsInbox paginates the inbox 20 activities at a time using IDs. ObjectIDs exceeding that maxID are ignored, and ObjectIDs under the min ID are ignored.

func (*Datastore) GetNotificationsInboxAsOrderedCollection

func (d *Datastore) GetNotificationsInboxAsOrderedCollection(ctx context.Context, username string) (vocab.ActivityStreamsOrderedCollection, error)

GetNotificationsInboxAsOrderedCollection returns Likes and Invites.

func (*Datastore) GetPublicInbox

func (d *Datastore) GetPublicInbox(ctx context.Context, minID string, maxID string, local bool, institute bool) (vocab.ActivityStreamsOrderedCollectionPage, error)

GetPublicInbox paginates the inbox 20 activities at a time using IDs. ObjectIDs exceeding that maxID are ignored, and ObjectIDs under the min ID are ignored.

func (*Datastore) GetPublicInboxAsOrderedCollection

func (d *Datastore) GetPublicInboxAsOrderedCollection(ctx context.Context, local bool, institute bool) (vocab.ActivityStreamsOrderedCollection, error)

GetPublicInboxAsOrderedCollection returns an orderedCollection. This collection is used to traverse the publicInbox collection in Mongo.

func (*Datastore) GetUserByUsername

func (d *Datastore) GetUserByUsername(ctx context.Context, username string) (*user.User, error)

func (*Datastore) IsHostSameInstitute

func (d *Datastore) IsHostSameInstitute(ctx context.Context, instance *url.URL) (bool, error)

func (*Datastore) LikeObject

func (d *Datastore) LikeObject(ctx context.Context, objectID *url.URL, actorID *url.URL, activityID *url.URL) error

func (*Datastore) RemoveFollowerFromActor

func (d *Datastore) RemoveFollowerFromActor(ctx context.Context, actorID, followerID string) error

func (*Datastore) UpdateActivity

func (d *Datastore) UpdateActivity(ctx context.Context, activity vocab.Type, inReplyTo *url.URL) error

func (*Datastore) UpdateActor

func (d *Datastore) UpdateActor(ctx context.Context, username string, displayName string, summary string, profilePicture vocab.ActivityStreamsImage) error

Jump to

Keyboard shortcuts

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