fix: unique constraint data
This commit is contained in:
@@ -10,8 +10,7 @@ import (
|
||||
)
|
||||
|
||||
type Session struct {
|
||||
Key string `json:"_key,omitempty" bson:"_key,omitempty"` // for arangodb
|
||||
// ObjectID string `json:"_id,omitempty" bson:"_id"` // for arangodb & mongodb
|
||||
Key string `json:"_key,omitempty" bson:"_key,omitempty"` // for arangodb
|
||||
ID string `gorm:"primaryKey;type:char(36)" json:"_id" bson:"_id"`
|
||||
UserID string `gorm:"type:char(36)" json:"user_id" bson:"user_id"`
|
||||
User User `json:"-" bson:"-"`
|
||||
@@ -29,7 +28,6 @@ func (mgr *manager) AddSession(session Session) error {
|
||||
|
||||
if IsORMSupported {
|
||||
session.Key = session.ID
|
||||
// session.ObjectID = session.ID
|
||||
res := mgr.sqlDB.Clauses(
|
||||
clause.OnConflict{
|
||||
DoNothing: true,
|
||||
@@ -53,7 +51,6 @@ func (mgr *manager) AddSession(session Session) error {
|
||||
|
||||
if IsMongoDB {
|
||||
session.Key = session.ID
|
||||
// session.ObjectID = session.ID
|
||||
session.CreatedAt = time.Now().Unix()
|
||||
session.UpdatedAt = time.Now().Unix()
|
||||
sessionCollection := mgr.mongodb.Collection(Collections.Session, options.Collection())
|
||||
|
Reference in New Issue
Block a user