Skip to content

Add generic types and ability to mutate files on update and delete operations#3

Merged
matschik merged 3 commits intomatschik:mainfrom
moritzleidinger:main
Jan 27, 2026
Merged

Add generic types and ability to mutate files on update and delete operations#3
matschik merged 3 commits intomatschik:mainfrom
moritzleidinger:main

Conversation

@moritzleidinger
Copy link
Copy Markdown
Contributor

@moritzleidinger moritzleidinger commented Jan 13, 2026

Hi, great library!

I've used it in a small project a bit, but ended up needing the ability to actually mutate the source files when updating or deleting rows. In this PR I've added a parameter (mutateDb) to the add, update and delete methods with default values that keep the current behaviour (mutating for add, non-mutating for update and delete). To make this an atomic operation, I've used your temporaryFileTask to update/delete the values in a temp file and subsequently replace the original file in a single rename operation.

I've also added generic types that can be passed like this: jsonlDir("path").file<DataType>("name"). This provides type safety for returned rows – and falls back to the existing JsonObject type if no type is provided.

I've also added tests to cover update and delete when passing mutateDb=true.

@moritzleidinger
Copy link
Copy Markdown
Contributor Author

Hi, just wanted to ask, if you'd consider merging my changes / additions. I'm happy to adapt, if you'd like. Otherwise I'll close the PR and fork. Thanks!

@matschik matschik merged commit da7d8db into matschik:main Jan 27, 2026
3 checks passed
@moritzleidinger
Copy link
Copy Markdown
Contributor Author

Thanks!

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.

2 participants