Skip to content

Conversation

@adrienaury
Copy link
Member

No description provided.

@adrienaury adrienaury linked an issue May 12, 2025 that may be closed by this pull request
@adrienaury adrienaury requested a review from Copilot May 12, 2025 09:51
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR updates the import functionality across the codebase to accept generic document values instead of a strict document.Reader, streamlining the import process.

  • Updated Import methods in core record components (Value, Object, and Array) to use a generic any type.
  • Modified the jsonline reader implementation to use bufio.Scanner instead of json.Decoder.
  • Refactored the import test and command execution to align with the new Import interface.

Reviewed Changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
pkg/posimap/import_test.go Updated test example to call Import with a document value instead of a reader.
pkg/posimap/driven/document/reader.go Reworked reader interface and implementation using bufio.Scanner.
pkg/posimap/core/record/value.go Changed Import to perform a direct assignment of value.
pkg/posimap/core/record/object.go Refactored Import to use a type switch on a generic value.
pkg/posimap/core/record/array.go Adjusted Import to iterate over an array and call Import on each record.
pkg/posimap/api/record.go Updated the Record interface's Import signature accordingly.
internal/infra/jsonline/reader.go Overhauled JSON reading logic to use bufio.Scanner with adjustable buffering.
internal/appli/command/unfold.go Refactored record construction and import handling in command execution.
Comments suppressed due to low confidence (1)

internal/infra/jsonline/reader.go:34

  • Consider verifying that this implementation correctly handles multi-line JSON inputs since bufio.Scanner reads input line by line and might not capture full JSON documents that span multiple lines.
if err := json.Unmarshal(r.scanner.Bytes(), &obj); err != nil {

@adrienaury adrienaury merged commit 37492cd into main May 12, 2025
1 check passed
@adrienaury adrienaury deleted the fix-import-document branch May 12, 2025 11:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix: import document in any order

2 participants