Commit Graph

20 Commits (511abf659d3f4e740d2898c71decbd222492b024)

Author SHA1 Message Date
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