-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0940301
commit 8059a0d
Showing
3 changed files
with
99 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
package gorm | ||
|
||
import ( | ||
"context" | ||
|
||
"github.com/nicholaspcr/GoDE/pkg/api/v1" | ||
"gorm.io/gorm" | ||
) | ||
|
||
type paretoModel struct { | ||
gorm.Model | ||
UserID uint | ||
User userModel `gorm:"foreignKey:UserID"` | ||
|
||
Vectors []vectorModel | ||
} | ||
|
||
type paretoStore struct{ *gorm.DB } | ||
|
||
func newParetoStore(db *gorm.DB) *paretoStore { return &paretoStore{db} } | ||
|
||
func (st *paretoStore) CreatePareto( | ||
ctx context.Context, usr *api.Pareto, | ||
) error { | ||
pareto := paretoModel{} | ||
st.DB.WithContext(ctx).Create(&pareto) | ||
return nil | ||
} | ||
|
||
func (st *paretoStore) GetPareto( | ||
ctx context.Context, usrIDs *api.ParetoIDs, | ||
) (*api.Pareto, error) { | ||
return nil, nil | ||
} | ||
|
||
func (st *paretoStore) UpdatePareto( | ||
ctx context.Context, usr *api.Pareto, fields ...string, | ||
) error { | ||
return nil | ||
} | ||
|
||
func (st *paretoStore) DeletePareto( | ||
ctx context.Context, usrIDs *api.ParetoIDs, | ||
) error { | ||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package gorm | ||
|
||
import ( | ||
"context" | ||
|
||
"github.com/nicholaspcr/GoDE/pkg/api/v1" | ||
"gorm.io/gorm" | ||
) | ||
|
||
type vectorModel struct { | ||
gorm.Model | ||
VectorID uint | ||
Vector paretoModel `gorm:"foreignKey:VectorID"` | ||
} | ||
|
||
type vectorStore struct{ *gorm.DB } | ||
|
||
func newVectorStore(db *gorm.DB) *vectorStore { return &vectorStore{db} } | ||
|
||
func (st *vectorStore) CreateVector( | ||
ctx context.Context, usr *api.Vector, | ||
) error { | ||
vector := vectorModel{} | ||
st.DB.WithContext(ctx).Create(&vector) | ||
return nil | ||
} | ||
|
||
func (st *vectorStore) GetVector( | ||
ctx context.Context, usrIDs *api.VectorIDs, | ||
) (*api.Vector, error) { | ||
return nil, nil | ||
} | ||
|
||
func (st *vectorStore) UpdateVector( | ||
ctx context.Context, usr *api.Vector, fields ...string, | ||
) error { | ||
return nil | ||
} | ||
|
||
func (st *vectorStore) DeleteVector( | ||
ctx context.Context, usrIDs *api.VectorIDs, | ||
) error { | ||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters