(ctx context.Context, ch <-chan *message.WriteMigrateTable)
| 93 | } |
| 94 | |
| 95 | func (c *Client) MigrateTable(ctx context.Context, ch <-chan *message.WriteMigrateTable) error { |
| 96 | // nolint:prealloc |
| 97 | var errs []error |
| 98 | |
| 99 | for msg := range ch { |
| 100 | if !c.spec.GenerateEmptyObjects { |
| 101 | continue |
| 102 | } |
| 103 | table := msg.GetTable() |
| 104 | objKey := c.spec.ReplacePathVariables(table.Name, uuid.NewString(), time.Now().UTC(), c.syncID) |
| 105 | // We don't need any locking here because all messages for the same table are processed sequentially |
| 106 | c.initializedTables[table.Name] = objKey |
| 107 | s, err := c.createObject(ctx, table, objKey) |
| 108 | if err != nil { |
| 109 | errs = append(errs, err) |
| 110 | continue |
| 111 | } |
| 112 | errs = append(errs, s.Finish()) |
| 113 | } |
| 114 | |
| 115 | return errors.Join(errs...) |
| 116 | } |
| 117 | |
| 118 | // sanitizeRecordJSONKeys replaces all invalid characters in JSON keys with underscores. This is required |
| 119 | // for compatibility with Athena. |
nothing calls this directly
no test coverage detected