Closed name256 closed 1 year ago
Thank you for your interest in my product.
Sure, it is possible. The easy-query framework has already abstracted the expressions, and the subsequent step is to implement the SQL syntax for each specific database. However, for specific methods like insertOrUpdate, it is desirable to abstract them into the expression itself. Abstracting special SQL dialects into the expression might cause compatibility issues with certain databases that do not support them.
Therefore, the functionality you mentioned can be fully implemented. Currently, I have implemented the default support for MySQL syntax, and since PGSQL is compatible with MySQL syntax, it does not require any modifications to achieve most SQL operations. In the future, I will gradually implement support for other databases. Moreover, I welcome collaboration and discussions through pull requests (PRs) on how to abstract expressions for different databases. For example, easyQuery.insertable(A.class).usePgSQL().onConflict could be a possible approach.
I will take some time studying the codebase and will let you know when I can be available to assist on adding more features to the project. I currently use a combination of products that sometimes make my code really bulky and I wanted to have one product that could cater for what I require since a lot of the projects are usually CRUD and not too complicated.
Abel Salama Birya 254727452403
On Sat, Jul 1, 2023 at 1:22 PM xuejmnet @.***> wrote:
Thank you for your interest in my product.
Sure, it is possible. The easy-query framework has already abstracted the expressions, and the subsequent step is to implement the SQL syntax for each specific database. However, for specific methods like insertOrUpdate, it is desirable to abstract them into the expression itself. Abstracting special SQL dialects into the expression might cause compatibility issues with certain databases that do not support them.
Therefore, the functionality you mentioned can be fully implemented. Currently, I have implemented the default support for MySQL syntax, and since PGSQL is compatible with MySQL syntax, it does not require any modifications to achieve most SQL operations. In the future, I will gradually implement support for other databases. Moreover, I welcome collaboration and discussions through pull requests (PRs) on how to abstract expressions for different databases. For example, easyQuery.insertable(A.class).usePgSQL().onConflict could be a possible approach. [image: image] https://user-images.githubusercontent.com/18061232/250267776-913089b1-257b-4bed-9d88-de1134abe94c.png
— Reply to this email directly, view it on GitHub https://github.com/xuejmnet/easy-query/issues/132#issuecomment-1615833056, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB762BB2RGHYVM4O6QN74ADXN725NANCNFSM6AAAAAAZ2WMLIM . You are receiving this because you authored the thread.Message ID: @.***>
It would be my honor to help anyone with my product, and I will also be working on developing documentation in English for the future. Currently, I am focusing on improving the Chinese documentation. : )
Good day to you,
I have taken some time to look at the code as well as I can. Kindly let me know how best I can be able to approach adding the 2 functions for MySQL & PostgreSQL.
Abel Salama Birya 254727452403
On Sat, Jul 1, 2023 at 4:18 PM xuejmnet @.***> wrote:
It would be my honor to help anyone with my product, and I will also be working on developing documentation in English for the future. Currently, I am focusing on improving the Chinese documentation. : )
— Reply to this email directly, view it on GitHub https://github.com/xuejmnet/easy-query/issues/132#issuecomment-1615906120, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB762BGYULDCVEREY6LHQHTXOAPSVANCNFSM6AAAAAAZ2WMLIM . You are receiving this because you authored the thread.Message ID: @.***>
@name256
public interface SQLOnDuplicateKeyIgnore<TChain> {
/**
* 部分数据库不支持
* @return
*/
TChain onDuplicateKeyIgnore();
}
Insertable
implments SQLOnDuplicateKeyIgnore
@name256 thanks very much. I have already implemented these two functions for you and made them differentiate between the usage of API and SQL in expressions by the users.
queuryable | insertable | updatable | deletable =====> expression builder ======> expression=====>sql
Thank you for the update
I will update the code and let you know how it goes.
Abel Salama Birya 254727452403
On Thu, Jul 6, 2023 at 5:39 PM xuejmnet @.***> wrote:
queuryable | insertable | updatable | deletable =====> expression builder ======> expression=====>sql
— Reply to this email directly, view it on GitHub https://github.com/xuejmnet/easy-query/issues/132#issuecomment-1623801382, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB762BFKMVMFNWIHW7NY2B3XO3E2VANCNFSM6AAAAAAZ2WMLIM . You are receiving this because you were mentioned.Message ID: @.***>
Good day,
I have tried using the library in my project but the latest version on maven is 0.9.32. Were you able to commit the updated library to maven central ro enable access to the onDuplicateKey methods?
Abel Salama Birya 254727452403
On Sat, Jul 8, 2023 at 8:12 AM Abel Birya @.***> wrote:
Thank you for the update
I will update the code and let you know how it goes.
Kind regards
Abel Salama Birya 254727452403
On Thu, Jul 6, 2023 at 5:39 PM xuejmnet @.***> wrote:
queuryable | insertable | updatable | deletable =====> expression builder ======> expression=====>sql
— Reply to this email directly, view it on GitHub https://github.com/xuejmnet/easy-query/issues/132#issuecomment-1623801382, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB762BFKMVMFNWIHW7NY2B3XO3E2VANCNFSM6AAAAAAZ2WMLIM . You are receiving this because you were mentioned.Message ID: @.***>
@name256 https://central.sonatype.com/search?q=easy-query use 1.1.17
Good day,
I have added the dependency to my project but I only seem to have the onDuplicateKeyIgnore() and onConflictDoNothing() methods.
Abel Salama Birya 254727452403
On Sat, Jul 8, 2023 at 12:40 PM xuejmnet @.***> wrote:
@name256 https://github.com/name256 https://central.sonatype.com/search?q=easy-query use 1.1.17
— Reply to this email directly, view it on GitHub https://github.com/xuejmnet/easy-query/issues/132#issuecomment-1626986871, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB762BGKFJP6P2IQWBQM5J3XPETHPANCNFSM6AAAAAAZ2WMLIM . You are receiving this because you were mentioned.Message ID: @.***>
Abel Salama Birya 254727452403
On Sat, Jul 8, 2023 at 12:48 PM Abel Birya @.***> wrote:
Good day,
I have added the dependency to my project but I only seem to have the onDuplicateKeyIgnore() and onConflictDoNothing() methods.
Kind regards
Abel Salama Birya 254727452403
On Sat, Jul 8, 2023 at 12:40 PM xuejmnet @.***> wrote:
@name256 https://github.com/name256 https://central.sonatype.com/search?q=easy-query use 1.1.17
— Reply to this email directly, view it on GitHub https://github.com/xuejmnet/easy-query/issues/132#issuecomment-1626986871, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB762BGKFJP6P2IQWBQM5J3XPETHPANCNFSM6AAAAAAZ2WMLIM . You are receiving this because you were mentioned.Message ID: @.***>
onConflictDoUpdate、onDuplicateKeyUpdate for mysql pgsql this commit will publish next version (1.1.18) at night
@name256 I have already released version 1.1.18. Please check the corresponding website in 30 minutes to an hour to see if you can find the corresponding version. If so, Maven can be used to reference it. https://central.sonatype.com/search?q=easy-query
I was able to download the newer version. Thank you.
However I believe that we may need to make updates on the PgSQL method onConflictUpdate() due to allow the specification of the duplicate key field.
INSERT INTO "books" ("name","created") VALUES ('Making Money',1688813216) ON CONFLICT ("id") DO UPDATE SET "name" = EXCLUDED."name", "created" = EXCLUDED."created" was aborted: ERROR: duplicate key value violates unique constraint "books_name"
Therefore on the above insert I would specify ON CONFLICT("name") to avoid the error above.
Abel Salama Birya 254727452403
On Sat, Jul 8, 2023 at 1:03 PM xuejmnet @.***> wrote:
@name256 https://github.com/name256 I have already released version 1.1.18. Please check the corresponding website in 30 minutes to an hour to see if you can find the corresponding version. If so, Maven can be used to reference it. https://central.sonatype.com/search?q=easy-query
— Reply to this email directly, view it on GitHub https://github.com/xuejmnet/easy-query/issues/132#issuecomment-1627031131, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB762BD5ULQ2R5JKQQ7FNMTXPEV7ZANCNFSM6AAAAAAZ2WMLIM . You are receiving this because you were mentioned.Message ID: @.***>
@name256 that's good idea next version i will support it
@name256 I have already released version 1.1.19. Please check the corresponding website in 30 minutes to an hour to see if you can find the corresponding version. If so, Maven can be used to reference it. https://central.sonatype.com/search?q=easy-query
@name256 unit test has samples
TopicAuto topicAuto = new TopicAuto();
topicAuto.setStars(999);
topicAuto.setTitle("title" + 999);
topicAuto.setCreateTime(LocalDateTime.now().plusDays(99));
Assert.assertNull(topicAuto.getId());
EntityInsertable<TopicAuto> insertable = easyQuery.insertable(topicAuto).onConflictDoUpdate(TopicAuto::getTitle,t->t.column(TopicAuto::getStars).column(TopicAuto::getCreateTime));
String sql = insertable.toSQL(topicAuto);
Assert.assertEquals("INSERT INTO \"t_topic_auto\" (\"stars\",\"title\",\"create_time\") VALUES (?,?,?) ON CONFLICT (\"title\") DO UPDATE SET \"stars\" = EXCLUDED.\"stars\", \"create_time\" = EXCLUDED.\"create_time\"",sql);
Good day,
I have been going through your product and was wondering whether you have the following functions for the different sql dialects. I believe PgSQL uses OnConflict