Comments (8)
hey @szymonnogiec great. I just read the description, this issue was created prior to having the Persister
interface, so let me give an updated guide line here:
Starting from the database
sub-packages, you'd have 3 implementation to do, the postgresql
, mongo
, and memory
.
I'd start by implementing the memory
one by creating a test and your implementation.
You may test only the memory
implementation with make test-mem
at the project root.
I'd create two new functions in the base.go
file UpdateDocuments
and DeleteDocuments
matching their non pluralized counter part.
Look at how the QueryDocuments
function uses criteria to be a bit inspired, you may look at the TestQueryDocuments
function in memory/base_test.go
to start writing the TestUpdateDocuments
and TestDeleteDocuments
tests.
Once you have a working implementation, you might want to add those two function in the internal/persister.go
Persister
interface and go write the implementation and tests for both postgresql
and mongo
packages.
The last step will be to modify the update and delete endpoints of the API to handle receiving criteria.
You'll noticed in the db.go:26
the following:
} else if r.Method == http.MethodPut {
database.update(w, r)
} else if r.Method == http.MethodDelete {
database.del(w, r)
}
For the update, one simple idea to handle the criteria would be to have a query string parameter in the URL and if present call a new handler that will be able to accept a more complex data object for instance:
{
"criteria": [],
"update": {}
}
Where the criteria
is the [][]interface{}
as seen in the query
function of db.go:152
. The code that parses the criteria / filters should be extracted from there since it will be re-used by the query
function and the two new function that you'll be creating.
Those are just suggestions, feel free to explore and use different ways etc.
Let me know if you have any questions.
from core.
Hey, I want to work on this issue;
from core.
Hello! @dstpierre @szymonnogiec don't you mind If I'll take a look as well?
from core.
Hey @rostikts it's awesome you want to work on this. @szymonnogiec started a couple of weeks ago, maybe you could reach them and see if there's way to collaborate on this. The issue is kind of big so I suppose it could be broken down into smaller tasks.
If you're not on Discord - join link yet, I'd suggest you join us there
Let me know how I can help with anything.
from core.
Hey @rostikts - @szymonnogiec replied in Discord and this issue could be split into two. One of you take the update part and the other the deletion part.
from core.
@szymonnogiec hey how things are going? Can I help with anything?
For the delete part, you may take a look at @rostikts changes for the update and reuse a similar approach / reuse the filtering codee.
Let us know if you have any question, I'd be happy to help you get started and/or unblock for this 👋
from core.
Hey @szymonnogiec last time you confirmed via Discord that you'd still want to tackle this one. Are you still interested? I'm planning a new release and I'd like that one to be part of the next version.
Let me know where things are please, thanks.
from core.
implemented the remaining bulk delete in #79 completing this bulk update/delete feature.
from core.
Related Issues (20)
- Ensure 3rd-party s3 compatible storage works HOT 1
- Enable grpc based clients HOT 2
- token creation datetime not saving correctly in database HOT 1
- Feature: GetTenantByEmail function HOT 1
- Extract less common features into plugins
- Remove everything re: Subscriptions / Billing HOT 1
- Enhance realtime data filtering for database events
- Replace Zerolog with Go's slog HOT 2
- Serverless SB workloads
- [core & cli] Save dev database between CLI restart HOT 1
- [docs] A tutorial for Next.js
- Add email interface to server-side function runtime HOT 13
- [cli] Add a tail command to follow server logs HOT 3
- Clean-up backend package test
- Using environment variables from .env file under vscode HOT 2
- Schedule task improvments
- [Refactoring] Add helper functions process HOT 2
- [backend-dart] Create a client library for Dart HOT 5
- review quick start for backend client library (go doc) HOT 1
- Add / remove user from account
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from core.