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 (
"context"
"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"
"github.com/neo4j/neo4j-go-driver/v5/neo4j"
"github.com/neo4j/neo4j-go-driver/v5/neo4j/config"
@ -15,7 +13,7 @@ type graphConnection struct {
graphDebug bool
}
func NewGraphConnection(graphDebug bool) database.OtterSpace {
func NewGraphConnection(graphDebug bool) OtterSpace {
return &graphConnection{
driver: nil,
graphDebug: graphDebug,

View File

@ -1,11 +1,11 @@
package postgres
package database
import (
"context"
"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"
"gorm.io/driver/postgres"
gormPostgres "gorm.io/driver/postgres"
"gorm.io/gorm"
)
@ -13,7 +13,7 @@ type postgresqlConnection struct {
db *gorm.DB
}
func NewPostgresqlConnection() database.OtterSpace {
func NewPostgresqlConnection() OtterSpace {
return &postgresqlConnection{
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 {
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
if err != nil {
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) {
//TODO implement me
panic("implement me")
return postgres.GetAllSourceNodes(ctx, p.db)
}
func (p postgresqlConnection) GetSourceByURL(ctx context.Context, sourceUrl string) (*models.AnthroveSource, error) {