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 3 additions and 3 deletions
Showing only changes of commit 2515fc5081 - Show all commits

View File

@ -16,7 +16,7 @@ func CreateSourceNode(ctx context.Context, db *gorm.DB, anthroveSource *pgModels
return fmt.Errorf("anthroveSource domain is required") return fmt.Errorf("anthroveSource domain is required")
} }
result := db.WithContext(ctx).Create(anthroveSource) result := db.WithContext(ctx).Where(pgModels.Source{Domain: anthroveSource.Domain}).FirstOrCreate(anthroveSource)
if result.Error != nil { if result.Error != nil {
return result.Error return result.Error

View File

@ -65,7 +65,7 @@ func TestCreateSourceNode(t *testing.T) {
db: gormDB, db: gormDB,
anthroveSource: validAnthroveSource, anthroveSource: validAnthroveSource,
}, },
wantErr: true, wantErr: false,
}, },
} }
for _, tt := range tests { for _, tt := range tests {
@ -249,7 +249,7 @@ func checkSourceNode(got *pgModels.Source, want *pgModels.Source) bool {
if want == nil && got == nil { if want == nil && got == nil {
return true return true
} }
if got.Domain != want.Domain { if got.Domain != want.Domain {
return false return false
} }