Dump dumps the database.
(ctx context.Context, out io.Writer, _ *storepb.DatabaseSchemaMetadata)
| 14 | |
| 15 | // Dump dumps the database. |
| 16 | func (d *Driver) Dump(ctx context.Context, out io.Writer, _ *storepb.DatabaseSchemaMetadata) error { |
| 17 | if d.databaseName == "" { |
| 18 | return errors.Errorf("SQLite can dump one database only at a time") |
| 19 | } |
| 20 | |
| 21 | // Find all dumpable databases and make sure the existence of the database to be dumped. |
| 22 | databases, err := d.getDatabases() |
| 23 | if err != nil { |
| 24 | return errors.Wrap(err, "failed to get databases") |
| 25 | } |
| 26 | exist := false |
| 27 | for _, n := range databases { |
| 28 | if n == d.databaseName { |
| 29 | exist = true |
| 30 | break |
| 31 | } |
| 32 | } |
| 33 | if !exist { |
| 34 | return errors.Errorf("database %s not found", d.databaseName) |
| 35 | } |
| 36 | |
| 37 | return d.dumpOneDatabase(ctx, out) |
| 38 | } |
| 39 | |
| 40 | type sqliteSchema struct { |
| 41 | schemaType string |
nothing calls this directly
no test coverage detected