Commit Graph

35 Commits (adapters/kpgx/v1.10.0)

Author SHA1 Message Date
Vinícius Garcia c55ba119a3 Add a few more tests 2023-07-11 10:26:13 -03:00
Vinícius Garcia 94d41d437e Fix typo 2023-04-04 23:08:00 -03:00
Vinícius Garcia 24599e6644 Improve NewWithAdapter to expect a dialect instead of a driver name 2022-12-21 21:23:54 -03:00
Vinícius Garcia 88167361c1 Add tests to the nullable Modifier 2022-12-15 19:48:31 -03:00
Vinícius Garcia 4598800f87 Add nullable modifier 2022-12-13 22:58:19 -03:00
Vinícius Garcia 259b3a228a Add some comments to internal/structs/structs.go 2022-12-13 22:34:54 -03:00
Vinícius Garcia 53ae836dc2 Fix CI 2022-12-04 20:56:54 -03:00
Vinícius Garcia 8f24194630 Add a sublicense to the kbuilder package 2022-12-04 20:48:55 -03:00
Vinícius Garcia d8fa0557e9 Move kbuilder into the internal package
This package is not ready to be used yet, so it is better to keep
it unaccessible.
2022-12-04 20:46:37 -03:00
Vinícius Garcia 5bfb5cd92a Improve error messages for scan errors on all adapters 2022-11-12 15:20:06 -03:00
Vinícius Garcia dd8a45c5d5 Rename kmodifiers to ksqlmodifiers 2022-10-18 12:57:27 -03:00
Vinícius Garcia 4890563c27 Expose some public types and functions so users can register new modifiers 2022-10-18 12:53:25 -03:00
Vinícius Garcia ad516d5e1f Add comment to json modifier 2022-10-18 10:50:58 -03:00
Vinícius Garcia 136ee66fe9 Fix behavior of json modifier to match what json.Unmarshal does for nil values
In the original implementation I thought that the `json` package
would set fields to its zero value during unmarshal if the input
JSON had a `null` value for that attribute.

After performing an small experiment I noticed this is not the case.

Thus, I have removed that behavior and now if the json contains
a `null` value for a field this field will be ignored by the
json modifier thus keeping its original value whatever it was.
2022-10-18 10:41:49 -03:00
Vinícius Garcia e48f82c255 Improve godoc for modifiers.LoadGlobalModifier 2022-10-18 10:35:36 -03:00
Vinícius Garcia 511abf659d Remove skipQueries option from modifiers since it was not working yet 2022-10-12 23:00:07 -03:00
Vinícius Garcia f41edb427d Add three new modifiers and fix a couple bugs
This commit adds these modifiers:

1. skipUpdates (with unit tests)
2. skipInserts (with unit tests)
3. skipQueries (no tests yet) (and not really working yet)

And handles two situations previously not considered:

1. Updates with no attributes will now return a properly formatted
   error instead of returning a syntax error.
2. Inserts with no values will now work on SQLite, Postgres and
   SQLServer
2022-10-12 22:47:33 -03:00
Vinícius Garcia 0d73ac9a18 Minor fix to the AttrModifier struct 2022-10-09 21:58:41 -03:00
Vinícius Garcia 57c0f4cade Add timeNowUTC and timeNowUTC/skipUpdates modifiers 2022-10-09 21:49:21 -03:00
Vinícius Garcia 8cba3efa2d Refactor modifiers so it is represented by a struct 2022-09-26 01:37:23 -03:00
Vinícius Garcia 9e94445cdc Add tests to the modifiers package 2022-09-23 22:49:41 -03:00
Vinícius Garcia 41f4d5487b Refactor modifiers into its own package 2022-09-21 22:30:20 -03:00
Vinícius Garcia cb15295e46 Rename serializers to modifiers 2022-09-21 21:38:30 -03:00
Vinícius Garcia f95cd2b7b2 Refactor code so that users can add their own serializers 2022-09-14 23:03:33 -03:00
Vinícius Garcia 8620600d01 Revert "Decouple ksql.DB from TagInfoCache so we can replace it during tests"
This reverts commit 74cb87bea0.

This was done because I noticed this first commit was unnecessary.

This original commit was written in order to allow tests where
the cache would return errors, but I noticed there is a way
of provoking these errors without the need of an extra layer
of abstraction.

Thus, in order to keep the code simpler and also avoid an extra
level of indirection I am undoing this change.
2022-08-27 12:18:02 -03:00
Vinícius Garcia 4b37adc905 Add more tests to ksql.Query() 2022-08-27 12:16:46 -03:00
Vinícius Garcia 74cb87bea0 Decouple ksql.DB from TagInfoCache so we can replace it during tests 2022-08-24 22:45:24 -03:00
Matheus de Oliveira db86670b6c Use sync.Map on global caches to avoid race-condition
As known, a map can't be accessed with read/write concurrently on
multiple goroutines. This just replaces all uses of global maps for
caches with sync.Map, which is safe to be used concurrently.
2022-07-04 17:28:27 -03:00
Vinícius Garcia af6ee27e3a Add error check for unexported fields with the ksql tag 2022-05-02 23:11:31 -03:00
Vinícius Garcia 1ed7684b6d Add case-insensitive support for database columns
Some databases (maybe all of them) will set the database column
names to lowercase.

This was problematic because we needed to match these names
with the ksql tags, which were not lowercased.

Now we support both versions, lowercased or not.
2022-04-30 13:01:03 -03:00
Vinícius Garcia a394fd0815 Move some functions to the internal package 2022-01-11 19:00:22 -03:00
Vinícius Garcia db6b126c69 Finish writing tests for ParseInputFunc() 2022-01-10 21:55:40 -03:00
Vinícius Garcia 898bb887cc Fix linter issue 2022-01-10 21:49:05 -03:00
Vinícius Garcia 3102a3d4c4 Add tests to ParseInputFunc and move it to internal/ 2022-01-10 21:02:39 -03:00
Vinícius Garcia 0ff7a92d72 Add tests for the error messages produced by the Mock() 2021-12-30 12:12:33 -03:00