// Execute executes a database migration from datastore to another, using the given migration function
Execute executes a database migration from datastore to another, using the given migration function
// Execute executes a database migration from datastore to another using the given migration function
func Execute(ctx context.Context, q query.Query, oldDs datastore.Batching, newDS datastore.Batching, oldType reflect.Type, migrateFunc reflect.Value) ([]datastore.Key, error) {
	qres, err := oldDs.Query(ctx, q)
	if err != nil {
		return nil, err
	}
	defer qres.Close()
	batch, err := newDS.Batch(ctx)
	if err != nil {
		return nil, fmt.Errorf("batch error: %w", err)
	}
	keys, errs := execute(ctx, qres, oldDs, newDS, oldType, migrateFunc, batch)
	err = batch.Commit(ctx)
	if err != nil {
		return nil, fmt.Errorf("committing: %w", err)
	}
	return keys, errs
}
func Execute ( ctx context . Context , q query . Query , oldDs datastore . Batching , newDS datastore . Batching , oldType reflect . Type , migrateFunc reflect . Value ) ( [ ] datastore . Key , error ) { qres , err := oldDs . Query ( ctx , q ) if err != nil { return nil , err } defer qres . Close ( ) batch , err := newDS . Batch ( ctx ) if err != nil { return nil , fmt . Errorf ( " " , err ) } keys , errs := execute ( ctx , qres , oldDs , newDS , oldType , migrateFunc , batch ) err = batch . Commit ( ctx ) if err != nil { return nil , fmt . Errorf ( " " , err ) } return keys , errs }
Execute executes a database migration from datastore to another, using the given migration function
Execute executes a database migration from datastore to another using the given migration function