Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add global variable QueryClauses #65

Merged
merged 1 commit into from Mar 2, 2022
Merged

add global variable QueryClauses #65

merged 1 commit into from Mar 2, 2022

Conversation

kvii
Copy link
Contributor

@kvii kvii commented Mar 1, 2022

  • Do only one thing
  • Non breaking API changes
  • Tested

What did this pull request do?

add a global variable QueryClause.
So we can add our own Clause before create a gorm.DB.

我想给 gorm 写一个解析 WINDOW 窗口函数的库。
但 mysql 并没有提供全局变量 QueryClause。
所以我不能通过修改全局变量的方式去 RegisterDefaultCallbacks。

可不可以添加这个全局变量?

User Case Description

// add WINDOW clause
mysql.QueryClauses = []string{"SELECT", "FROM", "WHERE", "WINDOW", "GROUP BY", "ORDER BY", "LIMIT", "FOR"}
gorm.Open(mysql.Open(dsn))

add a global variable QueryClause. 
So we can add our own Clause before create a gorm.DB.

``` go
// add WINDOW clause
mysql.QueryClauses = []string{"SELECT", "FROM", "WHERE", "WINDOW", "GROUP BY", "ORDER BY", "LIMIT", "FOR"}
gorm.Open(mysql.Open(dsn))
```

我想给 gorm 写一个解析 WINDOW 窗口函数的库。
但 mysql 并没有提供全局变量 QueryClause。
所以我不能通过修改全局变量的方式去 RegisterDefaultCallbacks。
@jinzhu jinzhu merged commit 2415f40 into go-gorm:master Mar 2, 2022
@jinzhu
Copy link
Member

@jinzhu jinzhu commented Mar 2, 2022

thank you for your PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants