-
-
Notifications
You must be signed in to change notification settings - Fork 215
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
Conversation
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.
Codecov ReportAttention: Patch coverage is
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
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
very good!!
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
tomap[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 naiveloader
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
func (<first letter of struct> *struct) method() {}
name style.when,should
naming pattern.m := mocks.NewConstructor(t)
.m.EXPECT().MethodName()
method to mock methods.example_test.go
.make dod
with none issues pointed out bygolangci-lint