BREAKING CHANGE: V2 of thr SDK #12

Merged
fenpaws merged 124 commits from develop/postgresql into main 2024-07-01 20:46:28 +00:00
2 changed files with 8 additions and 11 deletions
Showing only changes of commit ea2958b27d - Show all commits

View File

@ -1,10 +1,8 @@
package graph package database
import ( import (
"context" "context"
"git.dragse.it/anthrove/otter-space-sdk/internal/graph" "git.dragse.it/anthrove/otter-space-sdk/internal/graph"
"git.dragse.it/anthrove/otter-space-sdk/pkg/database"
"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"
@ -15,7 +13,7 @@ type graphConnection struct {
graphDebug bool graphDebug bool
} }
func NewGraphConnection(graphDebug bool) database.OtterSpace { func NewGraphConnection(graphDebug bool) OtterSpace {
return &graphConnection{ return &graphConnection{
driver: nil, driver: nil,
graphDebug: graphDebug, graphDebug: graphDebug,

View File

@ -1,11 +1,11 @@
package postgres package database
import ( import (
"context" "context"
"fmt" "fmt"
"git.dragse.it/anthrove/otter-space-sdk/pkg/database" "git.dragse.it/anthrove/otter-space-sdk/internal/postgres"
"git.dragse.it/anthrove/otter-space-sdk/pkg/models" "git.dragse.it/anthrove/otter-space-sdk/pkg/models"
"gorm.io/driver/postgres" gormPostgres "gorm.io/driver/postgres"
"gorm.io/gorm" "gorm.io/gorm"
) )
@ -13,7 +13,7 @@ type postgresqlConnection struct {
db *gorm.DB db *gorm.DB
} }
func NewPostgresqlConnection() database.OtterSpace { func NewPostgresqlConnection() OtterSpace {
return &postgresqlConnection{ return &postgresqlConnection{
db: nil, db: nil,
} }
@ -22,7 +22,7 @@ func NewPostgresqlConnection() database.OtterSpace {
func (p postgresqlConnection) Connect(ctx context.Context, endpoint string, username string, password string, database string, port int, ssl string, timezone string) error { func (p postgresqlConnection) Connect(ctx context.Context, endpoint string, username string, password string, database string, port int, ssl string, timezone string) error {
dsn := fmt.Sprintf("host=%s user=%s password=%s dbname=%s port=%d sslmode=%s TimeZone=%s", endpoint, username, password, database, port, ssl, timezone) dsn := fmt.Sprintf("host=%s user=%s password=%s dbname=%s port=%d sslmode=%s TimeZone=%s", endpoint, username, password, database, port, ssl, timezone)
db, err := gorm.Open(postgres.Open(dsn), &gorm.Config{}) db, err := gorm.Open(gormPostgres.Open(dsn), &gorm.Config{})
p.db = db p.db = db
if err != nil { if err != nil {
return err return err
@ -121,8 +121,7 @@ func (p postgresqlConnection) GetAllTags(ctx context.Context) ([]models.TagsWith
} }
func (p postgresqlConnection) GetAllSources(ctx context.Context) ([]models.AnthroveSource, error) { func (p postgresqlConnection) GetAllSources(ctx context.Context) ([]models.AnthroveSource, error) {
//TODO implement me return postgres.GetAllSourceNodes(ctx, p.db)
panic("implement me")
} }
func (p postgresqlConnection) GetSourceByURL(ctx context.Context, sourceUrl string) (*models.AnthroveSource, error) { func (p postgresqlConnection) GetSourceByURL(ctx context.Context, sourceUrl string) (*models.AnthroveSource, error) {