This repository has been archived on 2024-07-22. You can view files and clone it, but cannot push or open issues or pull requests.
otter-space-sdk/pkg/database/database.go
2024-06-22 22:30:03 +02:00

51 lines
2.3 KiB
Go

package database
import (
"context"
"git.dragse.it/anthrove/otter-space-sdk/pkg/models"
)
type OtterSpace interface {
Connect(ctx context.Context, endpoint string, username string, password string, database string, port int, ssl string, timezone string) error
AddUserWithRelationToSource(ctx context.Context, anthroveUserID models.AnthroveUserID, sourceDomain string, userID string, username string) error
AddSource(ctx context.Context, anthroveSource *models.Source) error
AddPost(ctx context.Context, anthrovePost *models.Post) error
AddTagWithRelationToPost(ctx context.Context, anthrovePostID models.AnthrovePostID, anthroveTag *models.Tag) error
LinkPostWithSource(ctx context.Context, anthrovePostID models.AnthrovePostID, anthroveSourceDomain string, anthrovePostRelationship *models.PostReference) error
LinkUserWithPost(ctx context.Context, anthroveUser *models.User, anthrovePost *models.Post) error
CheckUserPostLink(ctx context.Context, anthroveUserID models.AnthroveUserID, sourcePostID string, sourceUrl string) (bool, error)
GetPostByAnthroveID(ctx context.Context, anthrovePost *models.Post) (*models.Post, error)
GetPostBySourceURL(ctx context.Context, sourceUrl string) (*models.Post, error)
GetPostBySourceID(ctx context.Context, sourcePostID string) (*models.Post, error)
GetUserFavoriteCount(ctx context.Context, anthroveUserID models.AnthroveUserID) (int64, error)
GetUserSourceLinks(ctx context.Context, anthroveUserID models.AnthroveUserID) (map[string]models.UserSource, error)
GetSpecifiedUserSourceLink(ctx context.Context, anthroveUserID models.AnthroveUserID, sourceDisplayName string) (map[string]models.UserSource, error)
GetAnthroveUser(ctx context.Context, anthroveUserID models.AnthroveUserID) (*models.User, error)
GetAllAnthroveUserIDs(ctx context.Context) ([]models.AnthroveUserID, error)
GetUserFavoritePostsWithPagination(ctx context.Context, anthroveUserID models.AnthroveUserID, skip int, limit int) (*models.FavoriteList, error)
GetUserTagsTroughFavedPosts(ctx context.Context, anthroveUserID models.AnthroveUserID) ([]models.TagsWithFrequency, error)
GetAllTags(ctx context.Context) ([]models.TagsWithFrequency, error)
GetAllSources(ctx context.Context) ([]models.Source, error)
GetSourceByURL(ctx context.Context, sourceUrl string) (*models.Source, error)
}