(ctx context.Context, tmpTableName string, table *schema.Table)
| 104 | } |
| 105 | |
| 106 | func (c *Client) deleteByPK(ctx context.Context, tmpTableName string, table *schema.Table) error { |
| 107 | var sb strings.Builder |
| 108 | sb.WriteString("delete from " + table.Name + " using " + tmpTableName + " where ") |
| 109 | for i, col := range table.PrimaryKeys() { |
| 110 | if i > 0 { |
| 111 | sb.WriteString(" and ") |
| 112 | } |
| 113 | sb.WriteString(table.Name + "." + sanitizeID(col)) |
| 114 | sb.WriteString(" = ") |
| 115 | sb.WriteString(tmpTableName + "." + sanitizeID(col)) |
| 116 | } |
| 117 | |
| 118 | return c.exec(ctx, sb.String()) |
| 119 | } |
| 120 | |
| 121 | func (c *Client) copyFromFile(ctx context.Context, tableName string, fileName string, table *schema.Table) error { |
| 122 | return c.exec(ctx, "copy "+tableName+ |
no test coverage detected