Skip to content

Commit

Permalink
store: Rename vector store parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
nicholaspcr committed Feb 12, 2025
1 parent 77ebd22 commit a67eaa3
Showing 1 changed file with 18 additions and 9 deletions.
27 changes: 18 additions & 9 deletions internal/store/gorm/vector.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,36 +9,45 @@ import (

type vectorModel struct {
gorm.Model
ParetoD uint
Pareto paretoModel `gorm:"foreignKey:ParetoID"`
ParetoID uint
Pareto paretoModel `gorm:"foreignKey:ParetoID"`

Elements []float64
Objectives []float64
CrowdingDistance float64
}

type vectorStore struct{ *gorm.DB }

func newVectorStore(db *gorm.DB) *vectorStore { return &vectorStore{db} }

func (st *vectorStore) CreateVector(
ctx context.Context, usr *api.Vector,
ctx context.Context, vec *api.Vector, paretoID uint,
) error {
vector := vectorModel{}
st.DB.WithContext(ctx).Create(&vector)
return nil
vector := vectorModel{
ParetoID: paretoID,
Elements: vec.Elements,
Objectives: vec.Objectives,
CrowdingDistance: vec.CrowdingDistance,
}
tx := st.DB.WithContext(ctx).Create(&vector)
return tx.Error
}

func (st *vectorStore) GetVector(
ctx context.Context, usrIDs *api.VectorIDs,
ctx context.Context, vecIDs *api.VectorIDs,
) (*api.Vector, error) {
return nil, nil
}

func (st *vectorStore) UpdateVector(
ctx context.Context, usr *api.Vector, fields ...string,
ctx context.Context, vec *api.Vector, fields ...string,
) error {
return nil
}

func (st *vectorStore) DeleteVector(
ctx context.Context, usrIDs *api.VectorIDs,
ctx context.Context, vecIDs *api.VectorIDs,
) error {
return nil
}

0 comments on commit a67eaa3

Please sign in to comment.