This repository has been archived on 2024-07-22. You can view files and clone it, but cannot push or open issues or pull requests.
otter-space-sdk/internal/postgres/source.go
2024-06-03 23:55:30 +02:00

26 lines
598 B
Go

package postgres
import (
"context"
"git.dragse.it/anthrove/otter-space-sdk/pkg/models/graphModels"
log "github.com/sirupsen/logrus"
"gorm.io/gorm"
)
// GetAllSourceNodes returns a list of all models.AnthroveSource
func GetAllSourceNodes(ctx context.Context, db *gorm.DB) ([]graphModels.AnthroveSource, error) {
var sources []graphModels.AnthroveSource
result := db.WithContext(ctx).Find(&sources)
if result.Error != nil {
return nil, result.Error
}
log.WithFields(log.Fields{
"tag_amount": result.RowsAffected,
}).Trace("database: get all source nodes")
return sources, nil
}