-
Notifications
You must be signed in to change notification settings - Fork 4
Open
Description
code:
package repository
import (
"fmt"
"killrvideo/go-backend-astra-cql/models"
gocql "github.com/gocql/gocql"
)
type VideoDAL struct {
DB *gocql.Session
}
func NewVideoDAL(session *gocql.Session) *VideoDAL {
return &VideoDAL{
DB: session,
}
}
func (r *VideoDAL) GetVideo(id gocql.UUID) (*models.Video, error) {
video := &models.Video{Videoid: id}
var vector []float32
err1 := r.DB.Query(
"SELECT userid, name, description, location, preview_image_location, added_date, content_features FROM videos WHERE videoid = ?",
id,
).Scan(&video.Userid, &video.Name, &video.Description, &video.Location, &video.PreviewImageLocation, &video.AddedDate, &vector)
if err1 != nil {
return nil, fmt.Errorf("query has failed: %w", err1)
}
return video, nil
}Error handling returns:
{"error":"query has failed: can not unmarshal custom(org.apache.cassandra.db.marshal.VectorType(org.apache.cassandra.db.marshal.FloatType, 384)) into *[]float32"}Reverting to apache/cassandra-gocql-driver/v2 2.0.0 works, but then I lose the ability to use NewClusterFromURL and have to unzip/access the individual components of the Astra SCB to connect.
Metadata
Metadata
Assignees
Labels
No labels