Commit Graph

78 Commits (47dc19087f877fe71f0312835df4efbb5e4cf70c)

Author SHA1 Message Date
Vinícius Garcia 47dc19087f Use errors.Wrap(sql.ErrNoRows, "..") to make ErrRecordNotFound more idiomatic 2021-01-17 20:27:12 -03:00
Vinícius Garcia f06706b081 Fix scanRows to ignore extra columns from query without errors 2021-01-17 20:26:34 -03:00
Vinícius Garcia 0b97dbcff7 Improve reflection checks on Insert() function 2021-01-17 19:25:21 -03:00
Vinícius Garcia 5d083e35f0 Add tests for the Transaction function 2021-01-17 10:54:21 -03:00
Vinícius Garcia 479e47b018 Move example_service to examples 2021-01-15 23:35:17 -03:00
Vinícius Garcia 400f94e088 Update ORMProvider interface displayed on README 2021-01-15 10:46:47 -03:00
Vinícius Garcia 9d717717d4 Add initial version of Transaction() function 2021-01-14 23:56:58 -03:00
Vinícius Garcia f72ccb1664 Change type of Client.db to be an interface
This will be helpful soon when we add the Transactions feature
2021-01-14 23:02:12 -03:00
Vinícius Garcia ea7a23f32f Fix bug on FillStructWith so it ignores extra columns correctly
This bug was not being detected before because depending
on the order of the attributes on a map instance this test
would succeed by accident.

I was lucky enough to reproduce this error enough times to
understand it so it was possible to fix it.
2021-01-12 22:34:56 -03:00
Vinícius Garcia 247cdc0fd6 Add docker-compose.yml to setup a postgres database for tests 2021-01-12 22:19:24 -03:00
Vinícius Garcia 98cbc4e161 Fix database locked errors on tests
There was a missing `defer rows.Close()` on the ScanRows tests.
2021-01-12 22:18:59 -03:00
Vinícius Garcia 1d3fadc1f2 Update README.md 2021-01-12 20:46:29 -03:00
Vinícius Garcia 76830d5f5c Rename `examples/testing/` to `examples/example_service/` 2021-01-03 13:58:10 -03:00
Vinícius Garcia 689a60710d Update README to mention the example tests 2021-01-03 13:54:08 -03:00
Vinícius Garcia e49aa5f620 Add example tests to `examples/testing` 2021-01-03 13:41:21 -03:00
Vinícius Garcia 7ab871dad2 Update README and add an usage example 2020-12-31 14:10:47 -03:00
Vinícius Garcia 20287a3740 Add Exec() function to the API 2020-12-31 13:31:30 -03:00
Vinícius Garcia 8a65da552f Rename struct tags from `gorm` to `kissorm` 2020-12-31 11:59:24 -03:00
Vinícius Garcia 49c2842c03 Remove gorm dependency! We are independent now! 2020-12-31 11:57:33 -03:00
Vinícius Garcia 3cbf059b02 Remove all remaining calls to gorm function from tests 2020-12-31 11:50:28 -03:00
Vinícius Garcia eb02491414 Remove several calls to gorm function from tests 2020-12-31 10:31:26 -03:00
Vinícius Garcia a6e54f0558 Fix sqlite warning by updating the package version 2020-12-30 15:19:08 -03:00
Vinícius Garcia 673e417b8e Triple check if all errors are being handled 2020-12-30 15:02:35 -03:00
Vinícius Garcia 45380718f5 Update TestQueryChunks() to work with postgres 2020-12-30 12:39:01 -03:00
Vinícius Garcia 995ccd680c Fix Delete() to work with postgres 2020-12-30 12:33:56 -03:00
Vinícius Garcia ed8f0550aa Update TestQueryOne() to work with postgres 2020-12-30 12:28:37 -03:00
Vinícius Garcia 0cdaf00aaf Update TestQuery() to work with postgres 2020-12-30 12:26:35 -03:00
Vinícius Garcia f782fabb37 Fix Update() to work with postgres dialect 2020-12-29 23:51:31 -03:00
Vinícius Garcia de8f4e56d7 Fix Insert function to work with postgres
This commit adds the concept of dialects so we can support
different ways of escaping names, creating placeholders, etc.

Currently we are only using it on the Insert route and we only
support postgres and sqlite3, in the future we should add
more tests so we can start supporting more drivers.
2020-12-29 23:36:10 -03:00
Vinícius Garcia a7b3c12b95 Remove gorm dependency from Insert()
Although this implementation was meant to work with sqlite and
postgres it was not yet tested with postgres.
2020-12-27 14:26:32 -03:00
Vinícius Garcia 4030768f22 Improve Delete tests 2020-11-26 23:21:45 -03:00
Vinícius Garcia 9e84e4bb1b Remove gorm dependency from Delete() 2020-11-26 22:35:36 -03:00
Vinícius Garcia 1ea81bb8e0 Remove gorm dependency from Query() func 2020-11-23 01:20:13 -03:00
Vinícius Garcia 13bd087cee Remove gorm dependency from QueryOne() 2020-11-22 22:34:24 -03:00
Vinícius Garcia cdad1673f0 Remove gorm dependency from QueryChunks func 2020-11-21 02:51:17 -03:00
Vinícius Garcia 7197f21c7e Add error case tests for scanRows() func 2020-11-21 02:45:46 -03:00
Vinícius Garcia b6f69d52aa Add private scanRows() function 2020-11-21 02:35:56 -03:00
Vinícius Garcia c7e743527f Add README.md 2020-11-10 11:16:39 -03:00
Vinícius Garcia a05d26418f Improve comments for the QueryChunks func 2020-10-28 21:30:10 -03:00
Vinícius Garcia 6978474d41 Improve QueryChunks signature to be easier to use
The changes made on this commit were designed by
Raí Tamarindo (raitamarindo@gmail.com) on a previous meeting.
2020-10-28 08:55:58 -03:00
Vinícius Garcia c1f645216c Improve Update() to pass context to Exec 2020-10-26 15:32:22 -03:00
Vinícius Garcia 733284997f fixup! Remove the gorm dependency from the Update func 2020-10-26 13:21:48 -03:00
Vinícius Garcia 8c1c483462 Improve comments on StructToMap() 2020-10-26 09:36:33 -03:00
Vinícius Garcia 2f386e8541 fixup! Improve tests for the Update() function 2020-10-26 00:16:19 -03:00
Vinícius Garcia 417ea4660f Remove the gorm dependency from the Update func 2020-10-26 00:15:24 -03:00
Vinícius Garcia 4c740118fd Improve tests for the Update() function 2020-10-25 18:04:33 -03:00
Vinícius Garcia 335c30154d Fix linter complaints 2020-10-20 21:19:57 -03:00
Vinícius Garcia 5822e23de4 Add tests to QueryChunks function
This commit also fixes some bugs on this function and
adds a feature: Now you can return an kissorm.AbortIteration
error to abort the iteration and stop processing chunks.

This does not causes the call to QueryChunks to return an error,
since this is an expected error, thus, it is just ignored.
2020-10-14 15:45:16 -03:00
Vinícius Garcia 654997b09b Improve coverate on Query & QueryOne funcs 2020-10-14 13:53:09 -03:00
Vinícius Garcia e8bd504703 Split the Find function into the Query & QueryOne functions 2020-10-13 21:39:39 -03:00