mirror of
https://github.com/usememos/memos.git
synced 2025-06-05 22:09:59 +02:00
fix: filter args of postgres
This commit is contained in:
@@ -56,6 +56,7 @@ func (d *DB) ListMemoRelations(ctx context.Context, find *store.FindMemoRelation
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
convertCtx := filter.NewConvertContext()
|
convertCtx := filter.NewConvertContext()
|
||||||
|
convertCtx.ArgsOffset = len(args)
|
||||||
// ConvertExprToSQL converts the parsed expression to a SQL condition string.
|
// ConvertExprToSQL converts the parsed expression to a SQL condition string.
|
||||||
if err := d.ConvertExprToSQL(convertCtx, parsedExpr.GetExpr()); err != nil {
|
if err := d.ConvertExprToSQL(convertCtx, parsedExpr.GetExpr()); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@@ -64,7 +65,7 @@ func (d *DB) ListMemoRelations(ctx context.Context, find *store.FindMemoRelation
|
|||||||
if condition != "" {
|
if condition != "" {
|
||||||
where = append(where, fmt.Sprintf("memo_id IN (SELECT id FROM memo WHERE %s)", condition))
|
where = append(where, fmt.Sprintf("memo_id IN (SELECT id FROM memo WHERE %s)", condition))
|
||||||
where = append(where, fmt.Sprintf("related_memo_id IN (SELECT id FROM memo WHERE %s)", condition))
|
where = append(where, fmt.Sprintf("related_memo_id IN (SELECT id FROM memo WHERE %s)", condition))
|
||||||
args = append(args, append(convertCtx.Args, convertCtx.Args...)...)
|
args = append(args, convertCtx.Args...)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user