Format multiline calls in geoloc service
Signed-off-by: Émile Ré <emile@getprobo.com>
This commit is contained in:
@@ -77,7 +77,9 @@ func (s *Service) ImportFromDir(ctx context.Context, dataDir string) error {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := s.pgClient.WithConn(ctx, func(ctx context.Context, conn pg.Querier) error {
|
if err := s.pgClient.WithConn(
|
||||||
|
ctx,
|
||||||
|
func(ctx context.Context, conn pg.Querier) error {
|
||||||
if err := coredata.CreateIPCountryBlocksStaging(ctx, conn); err != nil {
|
if err := coredata.CreateIPCountryBlocksStaging(ctx, conn); err != nil {
|
||||||
return fmt.Errorf("cannot create staging table: %w", err)
|
return fmt.Errorf("cannot create staging table: %w", err)
|
||||||
}
|
}
|
||||||
@@ -91,20 +93,18 @@ func (s *Service) ImportFromDir(ctx context.Context, dataDir string) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}); err != nil {
|
},
|
||||||
_ = s.pgClient.WithConn(ctx, func(ctx context.Context, conn pg.Querier) error {
|
); err != nil {
|
||||||
return coredata.DropIPCountryBlocksStaging(ctx, conn)
|
|
||||||
})
|
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := s.pgClient.WithTx(ctx, func(ctx context.Context, tx pg.Tx) error {
|
if err := s.pgClient.WithTx(
|
||||||
return coredata.SwapIPCountryBlocksStaging(ctx, tx)
|
ctx,
|
||||||
}); err != nil {
|
func(ctx context.Context, tx pg.Tx) error {
|
||||||
_ = s.pgClient.WithConn(ctx, func(ctx context.Context, conn pg.Querier) error {
|
|
||||||
return coredata.DropIPCountryBlocksStaging(ctx, conn)
|
|
||||||
})
|
|
||||||
return fmt.Errorf("cannot swap staging table: %w", err)
|
return fmt.Errorf("cannot swap staging table: %w", err)
|
||||||
|
},
|
||||||
|
); err != nil {
|
||||||
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
|||||||
Reference in New Issue
Block a user