Commit Graph

240 Commits (3613ad769a09a30db2c847d5a4c79eeebbb9898d)

Author SHA1 Message Date
Vinícius Garcia 3613ad769a Add more tests to the mocks for codecov 2021-12-31 00:41:20 -03:00
Vinícius Garcia 3b7209b115 Again 2021-12-30 22:26:08 -03:00
Vinícius Garcia 002116eb38 Last attempt to make codecov ignore the examples 2021-12-30 20:07:36 -03:00
Vinícius Garcia 397df84022 Try to make codecov ignore example files again 2021-12-30 19:10:13 -03:00
Vinícius Garcia 3665e29724 Try to ignore the code coverage of the examples again 2021-12-30 12:54:13 -03:00
Vinícius Garcia b8cbfbd45b Improve doc comments on mocks.go 2021-12-30 12:53:46 -03:00
Vinícius Garcia 5b2627e596 Second attempt at ignoring coverage of the example files 2021-12-30 12:26:18 -03:00
Vinícius Garcia f26d943802 Add examples to codecov ignore 2021-12-30 12:17:00 -03:00
Vinícius Garcia ceb75c1932 Add testtools to codecov.yml ignore list 2021-12-30 12:13:17 -03:00
Vinícius Garcia 0ff7a92d72 Add tests for the error messages produced by the Mock() 2021-12-30 12:12:33 -03:00
Vinícius Garcia 6f2ecbef5a Write tests for two trivial functions for raising the test coverage 2021-12-28 22:09:28 -03:00
Vinícius Garcia 1e282717b7 Remove deprecated constructors ksql.New() and ksql.NewWithPgx()
It's recommended to use instead one of:

- kpgx.New(ctx, connURL, ksql.Config{})
- kmysql.New(ctx, connURL, ksql.Config{})
- ksqlserver.New(ctx, connURL, ksql.Config{})
- ksqlite3.New(ctx, connURL, ksql.Config{})
2021-12-28 21:37:07 -03:00
Vinícius Garcia d98cf857c0 Improve README 2021-12-28 21:11:09 -03:00
Vinícius Garcia 9be7f9fe35 Improve README 2021-12-28 21:10:23 -03:00
Vinícius Garcia 348fd0cec8 Reorder the badges on the README file 2021-12-28 21:09:17 -03:00
Vinícius Garcia d7bbf441c4 Fix CI badge after renaming the ci.yml file 2021-12-28 21:08:47 -03:00
Vinícius Garcia 23fc43e523 Improve README 2021-12-28 21:07:48 -03:00
Vinícius Garcia 5c385bd974
Merge pull request #13 from VinGarcia/update-ci
Add code coverage to CI
2021-12-28 20:26:05 -03:00
Vinícius Garcia bb7e3bdc23 Add code coverage badge to README 2021-12-28 20:22:35 -03:00
Vinícius Garcia e16c1b6659 Try adding code coverage to CI 2021-12-28 20:09:30 -03:00
Vinícius Garcia a31ae530a9
Merge pull request #10 from VinGarcia/v2.0.0
This PR includes one breaking change:

- The `Provider.Exec` function now returns 2 values instead of only the error, the extra argument is the number of affected rows.

This PR also adds:

- CI with tests and linter
- Dockertest for making tests easier to run not only on CI but also on local machines for contributors
- Some bug fixes: Now we are handling a few edge cases better:
  * If a struct has duplicated ksql tag names we will return an error instead of failing silently
  * If a struct has no ksql tags we will return an error instead of failing on the query
  * If a struct has attributes with no ksql tags they will be safely ignored instead of causing an error
  * If a jointed table struct has an extra attribute with no `tablename` tag it will be ignored too because having an error for this would be more confusing than just ignoring it.
2021-12-23 23:19:34 -03:00
Vinícius Garcia 5fffde3d34 Ignore structs not tagged with tablename on joined structs 2021-12-23 23:06:29 -03:00
Vinícius Garcia 402a9e98ac Fix all queries to ignore untagged struct attributes 2021-12-23 22:56:25 -03:00
Vinícius Garcia 487e2aa6ac Fix error that did not ignore fields with no ksql tags on QueryOne
The original attempt of fixing this problem was on commit:

e970a3546a
2021-12-23 22:43:33 -03:00
Vinícius Garcia d9f9d27266 Add error message for structs with no ksql tags 2021-12-22 22:52:16 -03:00
Vinícius Garcia b63990c9f6 Add golint to CI 2021-12-22 22:42:27 -03:00
Vinícius Garcia 733dc2b20b Add status badge 2021-12-22 22:19:00 -03:00
Vinícius Garcia 0f2c6b3dd8 Try to fix some required env vars 2021-12-22 21:47:27 -03:00
Vinícius Garcia d18ed2b1ab Try to fix and improve the CI script 2021-12-22 20:00:01 -03:00
Vinícius Garcia 71a9810582 Attempt to add CI 2021-12-22 19:44:16 -03:00
Vinícius Garcia 82a43fda87 Add error check for structs with duplicated tag names
Closes #6
2021-12-22 19:36:39 -03:00
Vinícius Garcia e970a3546a Fix bug on StrucToMap that was including fields not tagged with ksql 2021-12-22 19:19:53 -03:00
Vinícius Garcia e5e786cf4b Simplify TestMain 2021-12-22 17:56:51 -03:00
Vinícius Garcia 9a30559efa Improve README 2021-12-15 00:27:44 -03:00
Vinícius Garcia 70cfbccce2 Update README to include the new instructions on how to run the tests 2021-12-15 00:20:51 -03:00
Vinícius Garcia 914c351bcc Add docker-test support for SQLServer
This commit adds the last step for running all integration tests
with zero database setup =]
2021-12-15 00:14:32 -03:00
Vinícius Garcia fe464a217c Add docker test support for mysql 2021-12-14 23:55:49 -03:00
Vinícius Garcia 45edd4b1dd Add docker test setup for postgres
Before this commit the user would need to setup a local postgres
database manually in order to run the tests.

Now we are setting it up using docker-test which makes it easier.

We still require manual setup of sqlserver and mysql databases,
we'll fix these soon so that running the tests become trivial.
2021-12-14 23:34:26 -03:00
Vinícius Garcia 6a4ec2cd51 Update Exec signature to return the number of affected rows 2021-11-26 22:13:56 -03:00
Vinícius Garcia 97e248916c
Update README.md 2021-11-25 17:47:26 -03:00
Vinícius Garcia a1403dc9d3 Simplify the signature of the Delete() method
This change was finally made because the Delete function was the
only helper function that was not returning the ksql.ErrRecordNotFound
when no rows were found.

The other reason for this change is that we the most common use case is
by far for deleting a single element, and the philosophy of the library
is to optimize for the most common use-cases.

For making it easier to write queries for deleting many items
as well as many other less common use cases we
are already implementing the `kbuilder` package which is a
query builder.
2021-11-22 19:42:33 -03:00
Vinícius Garcia 40215d8099 Minor improvement on README file 2021-11-16 21:55:09 -03:00
Vinícius Garcia cb3d8eb572 Update benchmarks on README to include sql with prep statements 2021-11-16 21:18:23 -03:00
Vinícius Garcia 545ea48f0c Add benchmarks for the database/sql library using prepared-statements 2021-11-16 21:17:57 -03:00
Vinícius Garcia fc6a9c2950 Update README with the fixed version of the benchmark 2021-11-16 20:01:56 -03:00
Vinícius Garcia a5e71303cb Fix problem on the Querying benchmark for `sql`
By mistake (I forgot to delete a letter) I was calling
`sqlx.Open()` instead of `sql.Open()`, which invalidates
the benchmark.

This is now fixed.
2021-11-16 19:51:16 -03:00
Vinícius Garcia 83f0ce5369 Add constructor to SQLAdapter struct 2021-11-14 18:57:57 -03:00
Vinícius Garcia 25781352cb Add adapters for each possible db technology 2021-11-14 14:54:01 -03:00
Vinícius Garcia 54f19522e6 Update benchmarks on README 2021-11-14 11:23:54 -03:00
Vinícius Garcia b5a1f92fb8 Add pgx to benchmark 2021-11-14 11:13:35 -03:00