@@ -914,7 +914,7 @@ func (s *SqlStore) GetAccountByPeerPubKey(ctx context.Context, peerKey string) (
914
914
915
915
func (s * SqlStore ) GetAnyAccountID (ctx context.Context ) (string , error ) {
916
916
var account types.Account
917
- result := s .db .WithContext ( ctx ). Select ("id" ).Order ("created_at desc" ).Limit (1 ).Find (& account )
917
+ result := s .db .Select ("id" ).Order ("created_at desc" ).Limit (1 ).Find (& account )
918
918
if result .Error != nil {
919
919
return "" , status .NewGetAccountFromStoreError (result .Error )
920
920
}
@@ -1399,7 +1399,7 @@ func (s *SqlStore) AddPeerToGroup(ctx context.Context, accountID, peerID, groupI
1399
1399
PeerID : peerID ,
1400
1400
}
1401
1401
1402
- err := s .db .WithContext ( ctx ). Clauses (clause.OnConflict {
1402
+ err := s .db .Clauses (clause.OnConflict {
1403
1403
Columns : []clause.Column {{Name : "group_id" }, {Name : "peer_id" }},
1404
1404
DoNothing : true ,
1405
1405
}).Create (peer ).Error
@@ -1414,7 +1414,7 @@ func (s *SqlStore) AddPeerToGroup(ctx context.Context, accountID, peerID, groupI
1414
1414
1415
1415
// RemovePeerFromGroup removes a peer from a group
1416
1416
func (s * SqlStore ) RemovePeerFromGroup (ctx context.Context , peerID string , groupID string ) error {
1417
- err := s .db .WithContext ( ctx ).
1417
+ err := s .db .
1418
1418
Delete (& types.GroupPeer {}, "group_id = ? AND peer_id = ?" , groupID , peerID ).Error
1419
1419
1420
1420
if err != nil {
@@ -1427,7 +1427,7 @@ func (s *SqlStore) RemovePeerFromGroup(ctx context.Context, peerID string, group
1427
1427
1428
1428
// RemovePeerFromAllGroups removes a peer from all groups
1429
1429
func (s * SqlStore ) RemovePeerFromAllGroups (ctx context.Context , peerID string ) error {
1430
- err := s .db .WithContext ( ctx ).
1430
+ err := s .db .
1431
1431
Delete (& types.GroupPeer {}, "peer_id = ?" , peerID ).Error
1432
1432
1433
1433
if err != nil {
@@ -2015,7 +2015,7 @@ func (s *SqlStore) SavePolicy(ctx context.Context, policy *types.Policy) error {
2015
2015
}
2016
2016
2017
2017
func (s * SqlStore ) DeletePolicy (ctx context.Context , accountID , policyID string ) error {
2018
- return s .db .WithContext ( ctx ). Transaction (func (tx * gorm.DB ) error {
2018
+ return s .db .Transaction (func (tx * gorm.DB ) error {
2019
2019
if err := tx .Where ("policy_id = ?" , policyID ).Delete (& types.PolicyRule {}).Error ; err != nil {
2020
2020
return fmt .Errorf ("delete policy rules: %w" , err )
2021
2021
}
@@ -2706,7 +2706,7 @@ func (s *SqlStore) GetPeerByIP(ctx context.Context, lockStrength LockingStrength
2706
2706
}
2707
2707
2708
2708
func (s * SqlStore ) GetPeerIdByLabel (ctx context.Context , lockStrength LockingStrength , accountID string , hostname string ) (string , error ) {
2709
- tx := s .db . WithContext ( ctx )
2709
+ tx := s .db
2710
2710
if lockStrength != LockingStrengthNone {
2711
2711
tx = tx .Clauses (clause.Locking {Strength : string (lockStrength )})
2712
2712
}
0 commit comments