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

[proposal] Support _custom #150

Open
caibirdme opened this issue Jun 26, 2024 · 1 comment
Open

[proposal] Support _custom #150

caibirdme opened this issue Jun 26, 2024 · 1 comment

Comments

@caibirdme
Copy link
Contributor

caibirdme commented Jun 26, 2024

There're many cases that user want to use some new types such as JSON in sql. And new types are bound to related function calls. It's hard to enumerate them all, so we should give user a chance to insert some custom part of the sql in the where map.

// PartialSelection
type PartialSelection interface {
  Generate() (string, []interface{})
}

{
  "_custom_xx": typeA_impl_PartialSelection,
  "_custom_asd": typeB_impl_PartialSelection,
}

the key must be prefixed with _custom_ which tells gendry to carefully handle the PartialSelection.

And then, we can add some builtin functions that produce PartialSelection like:

func JSONContains(col, val, path string) PartialSelection

And user can also impl their owns as well

@jiangwei2514
Copy link
Contributor

可以使用 Comparable 接口,与现有的操作符(=,< 等)实现的接口一致
//Comparable requires type implements the Build method
type Comparable interface {
Build() ([]string, []interface{})
}

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

No branches or pull requests

2 participants