chore: streamline the naming to indicate more than graph support

Signed-off-by: SoXX <soxx@fenpa.ws>
This commit is contained in:
SoXX 2024-06-03 19:32:25 +02:00
parent 5015749f70
commit ccc6010466
7 changed files with 28 additions and 28 deletions

View File

@ -1,4 +1,4 @@
package internal package graph
import ( import (
"fmt" "fmt"

View File

@ -1,4 +1,4 @@
package internal package graph
import ( import (
"context" "context"

View File

@ -1,4 +1,4 @@
package internal package graph
import ( import (
"context" "context"

View File

@ -1,4 +1,4 @@
package internal package graph
import ( import (
"context" "context"

View File

@ -1,4 +1,4 @@
package internal package graph
import ( import (
"context" "context"

View File

@ -1,4 +1,4 @@
package internal package graph
import ( import (
"context" "context"

View File

@ -2,8 +2,8 @@ package database
import ( import (
"context" "context"
"git.dragse.it/anthrove/otter-space-sdk/internal/graph"
"git.dragse.it/anthrove/otter-space-sdk/internal"
"git.dragse.it/anthrove/otter-space-sdk/pkg/models" "git.dragse.it/anthrove/otter-space-sdk/pkg/models"
"github.com/neo4j/neo4j-go-driver/v5/neo4j" "github.com/neo4j/neo4j-go-driver/v5/neo4j"
"github.com/neo4j/neo4j-go-driver/v5/neo4j/config" "github.com/neo4j/neo4j-go-driver/v5/neo4j/config"
@ -37,87 +37,87 @@ func (g *graphConnection) Connect(ctx context.Context, endpoint string, username
} }
func (g *graphConnection) AddUserWithRelationToSource(ctx context.Context, anthroveUserID models.AnthroveUserID, sourceDomain string, userID string, username string) error { func (g *graphConnection) AddUserWithRelationToSource(ctx context.Context, anthroveUserID models.AnthroveUserID, sourceDomain string, userID string, username string) error {
return internal.CreateUserNodeWithSourceRelation(ctx, g.driver, anthroveUserID, sourceDomain, userID, username) return graph.CreateUserNodeWithSourceRelation(ctx, g.driver, anthroveUserID, sourceDomain, userID, username)
} }
func (g *graphConnection) AddSource(ctx context.Context, anthroveSource *models.AnthroveSource) error { func (g *graphConnection) AddSource(ctx context.Context, anthroveSource *models.AnthroveSource) error {
return internal.CreateSourceNode(ctx, g.driver, anthroveSource) return graph.CreateSourceNode(ctx, g.driver, anthroveSource)
} }
func (g *graphConnection) AddPost(ctx context.Context, anthrovePost *models.AnthrovePost) error { func (g *graphConnection) AddPost(ctx context.Context, anthrovePost *models.AnthrovePost) error {
return internal.CreateAnthrovePostNode(ctx, g.driver, anthrovePost) return graph.CreateAnthrovePostNode(ctx, g.driver, anthrovePost)
} }
func (g *graphConnection) AddTagWithRelationToPost(ctx context.Context, anthrovePostID models.AnthrovePostID, anthroveTag *models.AnthroveTag) error { func (g *graphConnection) AddTagWithRelationToPost(ctx context.Context, anthrovePostID models.AnthrovePostID, anthroveTag *models.AnthroveTag) error {
return internal.CreateTagNodeWitRelation(ctx, g.driver, anthrovePostID, anthroveTag) return graph.CreateTagNodeWitRelation(ctx, g.driver, anthrovePostID, anthroveTag)
} }
func (g *graphConnection) LinkPostWithSource(ctx context.Context, anthrovePostID models.AnthrovePostID, anthroveSourceDomain string, anthrovePostRelationship *models.AnthrovePostRelationship) error { func (g *graphConnection) LinkPostWithSource(ctx context.Context, anthrovePostID models.AnthrovePostID, anthroveSourceDomain string, anthrovePostRelationship *models.AnthrovePostRelationship) error {
return internal.EstablishAnthrovePostToSourceLink(ctx, g.driver, anthrovePostID, anthroveSourceDomain, anthrovePostRelationship) return graph.EstablishAnthrovePostToSourceLink(ctx, g.driver, anthrovePostID, anthroveSourceDomain, anthrovePostRelationship)
} }
func (g *graphConnection) LinkUserWithPost(ctx context.Context, anthroveUser *models.AnthroveUser, anthrovePost *models.AnthrovePost) error { func (g *graphConnection) LinkUserWithPost(ctx context.Context, anthroveUser *models.AnthroveUser, anthrovePost *models.AnthrovePost) error {
return internal.EstablishUserToPostLink(ctx, g.driver, anthroveUser, anthrovePost) return graph.EstablishUserToPostLink(ctx, g.driver, anthroveUser, anthrovePost)
} }
func (g *graphConnection) CheckUserPostLink(ctx context.Context, anthroveUserID models.AnthroveUserID, sourcePostID string, sourceUrl string) (bool, error) { func (g *graphConnection) CheckUserPostLink(ctx context.Context, anthroveUserID models.AnthroveUserID, sourcePostID string, sourceUrl string) (bool, error) {
return internal.CheckUserToPostLink(ctx, g.driver, anthroveUserID, sourcePostID, sourceUrl) return graph.CheckUserToPostLink(ctx, g.driver, anthroveUserID, sourcePostID, sourceUrl)
} }
func (g *graphConnection) CheckPostNodeExistsByAnthroveID(ctx context.Context, anthrovePost *models.AnthrovePost) (*models.AnthrovePost, bool, error) { func (g *graphConnection) CheckPostNodeExistsByAnthroveID(ctx context.Context, anthrovePost *models.AnthrovePost) (*models.AnthrovePost, bool, error) {
return internal.CheckIfAnthrovePostNodeExistsByAnthroveID(ctx, g.driver, anthrovePost) return graph.CheckIfAnthrovePostNodeExistsByAnthroveID(ctx, g.driver, anthrovePost)
} }
func (g *graphConnection) CheckPostNodeExistsBySourceURL(ctx context.Context, sourceUrl string) (*models.AnthrovePost, bool, error) { func (g *graphConnection) CheckPostNodeExistsBySourceURL(ctx context.Context, sourceUrl string) (*models.AnthrovePost, bool, error) {
return internal.CheckIfAnthrovePostNodeExistsBySourceURl(ctx, g.driver, sourceUrl) return graph.CheckIfAnthrovePostNodeExistsBySourceURl(ctx, g.driver, sourceUrl)
} }
func (g *graphConnection) CheckPostNodeExistsBySourceID(ctx context.Context, sourcePostID string) (*models.AnthrovePost, bool, error) { func (g *graphConnection) CheckPostNodeExistsBySourceID(ctx context.Context, sourcePostID string) (*models.AnthrovePost, bool, error) {
return internal.CheckIfAnthrovePostNodeExistsBySourceID(ctx, g.driver, sourcePostID) return graph.CheckIfAnthrovePostNodeExistsBySourceID(ctx, g.driver, sourcePostID)
} }
func (g *graphConnection) GetUserFavoriteCount(ctx context.Context, anthroveUserID models.AnthroveUserID) (int64, error) { func (g *graphConnection) GetUserFavoriteCount(ctx context.Context, anthroveUserID models.AnthroveUserID) (int64, error) {
return internal.GetUserFavoritesCount(ctx, g.driver, anthroveUserID) return graph.GetUserFavoritesCount(ctx, g.driver, anthroveUserID)
} }
func (g *graphConnection) GetUserSourceLinks(ctx context.Context, anthroveUserID models.AnthroveUserID) (map[string]models.AnthroveUserRelationship, error) { func (g *graphConnection) GetUserSourceLinks(ctx context.Context, anthroveUserID models.AnthroveUserID) (map[string]models.AnthroveUserRelationship, error) {
return internal.GetUserSourceLink(ctx, g.driver, anthroveUserID) return graph.GetUserSourceLink(ctx, g.driver, anthroveUserID)
} }
func (g *graphConnection) GetSpecifiedUserSourceLink(ctx context.Context, anthroveUserID models.AnthroveUserID, sourceDisplayName string) (map[string]models.AnthroveUserRelationship, error) { func (g *graphConnection) GetSpecifiedUserSourceLink(ctx context.Context, anthroveUserID models.AnthroveUserID, sourceDisplayName string) (map[string]models.AnthroveUserRelationship, error) {
return internal.GetSpecifiedUserSourceLink(ctx, g.driver, anthroveUserID, sourceDisplayName) return graph.GetSpecifiedUserSourceLink(ctx, g.driver, anthroveUserID, sourceDisplayName)
} }
func (g *graphConnection) GetAnthroveUser(ctx context.Context, anthroveUserID models.AnthroveUserID) (*models.AnthroveUser, error) { func (g *graphConnection) GetAnthroveUser(ctx context.Context, anthroveUserID models.AnthroveUserID) (*models.AnthroveUser, error) {
return internal.GetAnthroveUser(ctx, g.driver, anthroveUserID) return graph.GetAnthroveUser(ctx, g.driver, anthroveUserID)
} }
func (g *graphConnection) GetAllAnthroveUserIDs(ctx context.Context) ([]models.AnthroveUserID, error) { func (g *graphConnection) GetAllAnthroveUserIDs(ctx context.Context) ([]models.AnthroveUserID, error) {
return internal.GetAllAnthroveUserIDs(ctx, g.driver) return graph.GetAllAnthroveUserIDs(ctx, g.driver)
} }
func (g *graphConnection) GetUserFavoritePostsWithPagination(ctx context.Context, anthroveUserID models.AnthroveUserID, skip int, limit int) (*models.FavoriteList, error) { func (g *graphConnection) GetUserFavoritePostsWithPagination(ctx context.Context, anthroveUserID models.AnthroveUserID, skip int, limit int) (*models.FavoriteList, error) {
return internal.GetUserFavoriteNodeWithPagination(ctx, g.driver, anthroveUserID, skip, limit) return graph.GetUserFavoriteNodeWithPagination(ctx, g.driver, anthroveUserID, skip, limit)
} }
func (g *graphConnection) GetUserTagsTroughFavedPosts(ctx context.Context, anthroveUserID models.AnthroveUserID) ([]models.TagsWithFrequency, error) { func (g *graphConnection) GetUserTagsTroughFavedPosts(ctx context.Context, anthroveUserID models.AnthroveUserID) ([]models.TagsWithFrequency, error) {
return internal.GetUserTagNodeWitRelationToFavedPosts(ctx, g.driver, anthroveUserID) return graph.GetUserTagNodeWitRelationToFavedPosts(ctx, g.driver, anthroveUserID)
} }
func (g *graphConnection) GetAllTags(ctx context.Context) ([]models.TagsWithFrequency, error) { func (g *graphConnection) GetAllTags(ctx context.Context) ([]models.TagsWithFrequency, error) {
return internal.GetTags(ctx, g.driver) return graph.GetTags(ctx, g.driver)
} }
func (g *graphConnection) GetAllSources(ctx context.Context) ([]models.AnthroveSource, error) { func (g *graphConnection) GetAllSources(ctx context.Context) ([]models.AnthroveSource, error) {
return internal.GetAllSourceNodes(ctx, g.driver) return graph.GetAllSourceNodes(ctx, g.driver)
} }
func (g *graphConnection) GetSourceByURL(ctx context.Context, sourceUrl string) (*models.AnthroveSource, error) { func (g *graphConnection) GetSourceByURL(ctx context.Context, sourceUrl string) (*models.AnthroveSource, error) {
return internal.GetSourceNodesByURL(ctx, g.driver, sourceUrl) return graph.GetSourceNodesByURL(ctx, g.driver, sourceUrl)
} }
func logger(graphDebug bool) func(config *config.Config) { func logger(graphDebug bool) func(config *config.Config) {
return func(config *config.Config) { return func(config *config.Config) {
config.Log = internal.NewGraphLogger(graphDebug) config.Log = graph.NewGraphLogger(graphDebug)
} }
} }