Skip to content

Instantly share code, notes, and snippets.

@orcaman
Last active July 18, 2019 09:06
Show Gist options
  • Save orcaman/4ee87bcd4f651b687b9288f949f8a3b9 to your computer and use it in GitHub Desktop.
Save orcaman/4ee87bcd4f651b687b9288f949f8a3b9 to your computer and use it in GitHub Desktop.
for _, d := range p.DatasetDescriptors {
for _, t := range d.TableDescriptors {
wg.Add(1)
go func(d *datasetDescriptor, t *tableDescriptor) {
rl.Take()
defer wg.Done()
schemaPath := *backupPath + "/" + d.Name + "/" + t.Name + "/schema.json"
if fileExists(ctx, schemaPath, bkt) {
return
}
err := writeSchemaFile(ctx, bkt, schemaPath, t.Schema)
if err != nil {
errc <- err
}
dataPath := "gs://" + *bucket + "/" + *backupPath + "/" + d.Name + "/" + t.Name + "/data-*.json"
err = p.writeDataFiles(ctx, dataPath, p.projectID, d.Name, t.Name)
if err != nil {
errc <- err
}
}(d, t)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment