(ctx context.Context, exec sqlExecutor, record RawRecord)
| 1030 | } |
| 1031 | |
| 1032 | func insertRecord(ctx context.Context, exec sqlExecutor, record RawRecord) error { |
| 1033 | if _, err := exec.ExecContext( |
| 1034 | ctx, |
| 1035 | `INSERT INTO resource_records ( |
| 1036 | kind, id, version, scope_kind, scope_id, owner_kind, |
| 1037 | owner_id, source_kind, source_id, spec_json, created_at, updated_at |
| 1038 | ) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`, |
| 1039 | record.Kind, |
| 1040 | record.ID, |
| 1041 | record.Version, |
| 1042 | record.Scope.Kind, |
| 1043 | nullableScopeID(record.Scope), |
| 1044 | record.Owner.Kind, |
| 1045 | record.Owner.ID, |
| 1046 | record.Source.Kind, |
| 1047 | record.Source.ID, |
| 1048 | string(record.SpecJSON), |
| 1049 | store.FormatTimestamp(record.CreatedAt), |
| 1050 | store.FormatTimestamp(record.UpdatedAt), |
| 1051 | ); err != nil { |
| 1052 | return fmt.Errorf("resources: insert record %q/%q: %w", record.Kind, record.ID, err) |
| 1053 | } |
| 1054 | return nil |
| 1055 | } |
| 1056 | |
| 1057 | func updateRecord(ctx context.Context, exec sqlExecutor, record RawRecord, expectedVersion int64) error { |
| 1058 | result, err := exec.ExecContext( |
no test coverage detected