Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature/repository-loader #490

Merged
merged 6 commits into from
Oct 25, 2024
Merged

Conversation

zjom
Copy link

@zjom zjom commented Oct 23, 2024

Description
The processor/repository should be able to store loaded assets in memory.
I changed the template input and output types of repository from string to map[string]any.
We can then store loaded assets as a byte slice in the repository.
Because the repository is now returning a deserialised structure, rather than a string, I updated NewPdf to take in the deserialised structure.

I added a Loader interface and naive loader implementation which takes a path (local file path or url with scheme) and returns its contents.
I believe that the Deserializer should depend on the loader interface (at the very least for template parsing).
I added loader as field in the jsonDeserializer struct.

Checklist

  • All methods associated with structs has func (<first letter of struct> *struct) method() {} name style.
  • Wrote unit tests for new/changed features.
  • Followed the unit test when,should naming pattern.
  • All mocks created with m := mocks.NewConstructor(t).
  • All mocks using m.EXPECT().MethodName() method to mock methods.
  • Updated docs/doc.go and docs/*
  • Updated example_test.go.
  • Updated README.md
  • New public methods/structs/interfaces has comments upside them explaining they responsibilities
  • Executed make dod with none issues pointed out by golangci-lint

zjom added 6 commits October 24, 2024 09:38
the repository should be able to store assets after they have been
loaded into memory.

switching from string to map[string]any facilitates this
Loader decouples file loading/ fetching logic from the rest of the
processor.

Loader should be used when deserialising a template with constant assets
to be stored in the repository.

Loader should also be used when deserialising content with assets
If there are assets found in the template in the process of
deserialising, they should be loaded into memory.
Copy link

codecov bot commented Oct 24, 2024

Codecov Report

Attention: Patch coverage is 71.42857% with 12 lines in your changes missing coverage. Please review.

Please upload report for BASE (doc-processor@0568532). Learn more about missing BASE report.

Files with missing lines Patch % Lines
pkg/processor/loader/loader.go 70.00% 6 Missing and 6 partials ⚠️
Additional details and impacted files
@@               Coverage Diff                @@
##             doc-processor     #490   +/-   ##
================================================
  Coverage                 ?   80.91%           
================================================
  Files                    ?       91           
  Lines                    ?     3084           
  Branches                 ?        0           
================================================
  Hits                     ?     2495           
  Misses                   ?      545           
  Partials                 ?       44           
Flag Coverage Δ
unittests 80.91% <71.43%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Collaborator

@Fernando-hub527 Fernando-hub527 left a comment

Choose a reason for hiding this comment

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

very good!!

@johnfercher johnfercher merged commit 5bfc846 into johnfercher:doc-processor Oct 25, 2024
4 of 5 checks passed
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.

3 participants