Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
canifa_note
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Vũ Hoàng Anh
canifa_note
Commits
6b507ff6
Unverified
Commit
6b507ff6
authored
Aug 10, 2025
by
Neo
Committed by
GitHub
Aug 10, 2025
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: pinned shortcut comparison operators (#4987)
parent
9f8921d3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
2 deletions
+33
-2
common_converter.go
plugin/filter/common_converter.go
+33
-2
No files found.
plugin/filter/common_converter.go
View file @
6b507ff6
...
@@ -122,7 +122,7 @@ func (c *CommonSQLConverter) handleComparisonOperator(ctx *ConvertContext, callE
...
@@ -122,7 +122,7 @@ func (c *CommonSQLConverter) handleComparisonOperator(ctx *ConvertContext, callE
return
err
return
err
}
}
if
!
slices
.
Contains
([]
string
{
"creator_id"
,
"created_ts"
,
"updated_ts"
,
"visibility"
,
"content"
,
"has_task_list"
,
"has_link"
,
"has_code"
,
"has_incomplete_tasks"
},
identifier
)
{
if
!
slices
.
Contains
([]
string
{
"creator_id"
,
"created_ts"
,
"updated_ts"
,
"visibility"
,
"content"
,
"
pinned"
,
"
has_task_list"
,
"has_link"
,
"has_code"
,
"has_incomplete_tasks"
},
identifier
)
{
return
errors
.
Errorf
(
"invalid identifier for %s"
,
callExpr
.
Function
)
return
errors
.
Errorf
(
"invalid identifier for %s"
,
callExpr
.
Function
)
}
}
...
@@ -140,6 +140,8 @@ func (c *CommonSQLConverter) handleComparisonOperator(ctx *ConvertContext, callE
...
@@ -140,6 +140,8 @@ func (c *CommonSQLConverter) handleComparisonOperator(ctx *ConvertContext, callE
return
c
.
handleStringComparison
(
ctx
,
identifier
,
operator
,
value
)
return
c
.
handleStringComparison
(
ctx
,
identifier
,
operator
,
value
)
case
"creator_id"
:
case
"creator_id"
:
return
c
.
handleIntComparison
(
ctx
,
identifier
,
operator
,
value
)
return
c
.
handleIntComparison
(
ctx
,
identifier
,
operator
,
value
)
case
"pinned"
:
return
c
.
handlePinnedComparison
(
ctx
,
operator
,
value
)
case
"has_task_list"
,
"has_link"
,
"has_code"
,
"has_incomplete_tasks"
:
case
"has_task_list"
,
"has_link"
,
"has_code"
,
"has_incomplete_tasks"
:
return
c
.
handleBooleanComparison
(
ctx
,
identifier
,
operator
,
value
)
return
c
.
handleBooleanComparison
(
ctx
,
identifier
,
operator
,
value
)
}
}
...
@@ -491,6 +493,35 @@ func (c *CommonSQLConverter) handleIntComparison(ctx *ConvertContext, field, ope
...
@@ -491,6 +493,35 @@ func (c *CommonSQLConverter) handleIntComparison(ctx *ConvertContext, field, ope
return
nil
return
nil
}
}
func
(
c
*
CommonSQLConverter
)
handlePinnedComparison
(
ctx
*
ConvertContext
,
operator
string
,
value
interface
{})
error
{
if
operator
!=
"="
&&
operator
!=
"!="
{
return
errors
.
Errorf
(
"invalid operator for pinned field"
)
}
valueBool
,
ok
:=
value
.
(
bool
)
if
!
ok
{
return
errors
.
New
(
"invalid boolean value for pinned field"
)
}
tablePrefix
:=
c
.
dialect
.
GetTablePrefix
(
"memo"
)
var
sqlExpr
string
if
_
,
ok
:=
c
.
dialect
.
(
*
PostgreSQLDialect
);
ok
{
sqlExpr
=
fmt
.
Sprintf
(
"%s.pinned %s %s"
,
tablePrefix
,
operator
,
c
.
dialect
.
GetParameterPlaceholder
(
c
.
paramIndex
))
}
else
{
sqlExpr
=
fmt
.
Sprintf
(
"%s.`pinned` %s %s"
,
tablePrefix
,
operator
,
c
.
dialect
.
GetParameterPlaceholder
(
c
.
paramIndex
))
}
if
_
,
err
:=
ctx
.
Buffer
.
WriteString
(
sqlExpr
);
err
!=
nil
{
return
err
}
ctx
.
Args
=
append
(
ctx
.
Args
,
c
.
dialect
.
GetBooleanValue
(
valueBool
))
c
.
paramIndex
++
return
nil
}
func
(
c
*
CommonSQLConverter
)
handleBooleanComparison
(
ctx
*
ConvertContext
,
field
,
operator
string
,
value
interface
{})
error
{
func
(
c
*
CommonSQLConverter
)
handleBooleanComparison
(
ctx
*
ConvertContext
,
field
,
operator
string
,
value
interface
{})
error
{
if
operator
!=
"="
&&
operator
!=
"!="
{
if
operator
!=
"="
&&
operator
!=
"!="
{
return
errors
.
Errorf
(
"invalid operator for %s"
,
field
)
return
errors
.
Errorf
(
"invalid operator for %s"
,
field
)
...
@@ -574,7 +605,7 @@ func (c *CommonSQLConverter) handleBooleanComparison(ctx *ConvertContext, field,
...
@@ -574,7 +605,7 @@ func (c *CommonSQLConverter) handleBooleanComparison(ctx *ConvertContext, field,
// Handle PostgreSQL differently - it uses the raw operator
// Handle PostgreSQL differently - it uses the raw operator
if
_
,
ok
:=
c
.
dialect
.
(
*
PostgreSQLDialect
);
ok
{
if
_
,
ok
:=
c
.
dialect
.
(
*
PostgreSQLDialect
);
ok
{
var
jsonExtract
=
c
.
dialect
.
GetJSONExtract
(
jsonPath
)
jsonExtract
:
=
c
.
dialect
.
GetJSONExtract
(
jsonPath
)
sqlExpr
:=
fmt
.
Sprintf
(
"(%s)::boolean %s %s"
,
sqlExpr
:=
fmt
.
Sprintf
(
"(%s)::boolean %s %s"
,
jsonExtract
,
jsonExtract
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment