From ccc6010466710ea9ad371f76c8c37492aa047d92 Mon Sep 17 00:00:00 2001 From: SoXX Date: Mon, 3 Jun 2024 19:32:25 +0200 Subject: [PATCH] chore: streamline the naming to indicate more than graph support Signed-off-by: SoXX --- internal/{ => graph}/logger.go | 2 +- internal/{ => graph}/post.go | 2 +- internal/{ => graph}/relationships.go | 2 +- internal/{ => graph}/source.go | 2 +- internal/{ => graph}/tag.go | 2 +- internal/{ => graph}/user.go | 2 +- pkg/database/graph_impl.go | 44 +++++++++++++-------------- 7 files changed, 28 insertions(+), 28 deletions(-) rename internal/{ => graph}/logger.go (98%) rename internal/{ => graph}/post.go (99%) rename internal/{ => graph}/relationships.go (99%) rename internal/{ => graph}/source.go (99%) rename internal/{ => graph}/tag.go (99%) rename internal/{ => graph}/user.go (99%) diff --git a/internal/logger.go b/internal/graph/logger.go similarity index 98% rename from internal/logger.go rename to internal/graph/logger.go index 5522934..914db3a 100644 --- a/internal/logger.go +++ b/internal/graph/logger.go @@ -1,4 +1,4 @@ -package internal +package graph import ( "fmt" diff --git a/internal/post.go b/internal/graph/post.go similarity index 99% rename from internal/post.go rename to internal/graph/post.go index 78136ac..6a39f51 100644 --- a/internal/post.go +++ b/internal/graph/post.go @@ -1,4 +1,4 @@ -package internal +package graph import ( "context" diff --git a/internal/relationships.go b/internal/graph/relationships.go similarity index 99% rename from internal/relationships.go rename to internal/graph/relationships.go index 6d12ddc..b77c8e6 100644 --- a/internal/relationships.go +++ b/internal/graph/relationships.go @@ -1,4 +1,4 @@ -package internal +package graph import ( "context" diff --git a/internal/source.go b/internal/graph/source.go similarity index 99% rename from internal/source.go rename to internal/graph/source.go index e3c36a6..cbdc690 100644 --- a/internal/source.go +++ b/internal/graph/source.go @@ -1,4 +1,4 @@ -package internal +package graph import ( "context" diff --git a/internal/tag.go b/internal/graph/tag.go similarity index 99% rename from internal/tag.go rename to internal/graph/tag.go index b91d1cb..0838b13 100644 --- a/internal/tag.go +++ b/internal/graph/tag.go @@ -1,4 +1,4 @@ -package internal +package graph import ( "context" diff --git a/internal/user.go b/internal/graph/user.go similarity index 99% rename from internal/user.go rename to internal/graph/user.go index 5e9fe4d..7d4a8e8 100644 --- a/internal/user.go +++ b/internal/graph/user.go @@ -1,4 +1,4 @@ -package internal +package graph import ( "context" diff --git a/pkg/database/graph_impl.go b/pkg/database/graph_impl.go index 68bc025..fac6a85 100644 --- a/pkg/database/graph_impl.go +++ b/pkg/database/graph_impl.go @@ -2,8 +2,8 @@ package database import ( "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" "github.com/neo4j/neo4j-go-driver/v5/neo4j" "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 { - 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 { - 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 { - 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 { - 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 { - 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 { - 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) { - 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) { - 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) { - 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) { - 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) { - 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) { - 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) { - 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) { - return internal.GetAnthroveUser(ctx, g.driver, anthroveUserID) + return graph.GetAnthroveUser(ctx, g.driver, anthroveUserID) } 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) { - 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) { - return internal.GetUserTagNodeWitRelationToFavedPosts(ctx, g.driver, anthroveUserID) + return graph.GetUserTagNodeWitRelationToFavedPosts(ctx, g.driver, anthroveUserID) } 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) { - return internal.GetAllSourceNodes(ctx, g.driver) + return graph.GetAllSourceNodes(ctx, g.driver) } 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) { return func(config *config.Config) { - config.Log = internal.NewGraphLogger(graphDebug) + config.Log = graph.NewGraphLogger(graphDebug) } }