good morning!!!!

Skip to content
Snippets Groups Projects
Commit 0301567f authored by Garet Halliday's avatar Garet Halliday
Browse files

fix

parent 40a61db1
Branches
No related tags found
No related merge requests found
Pipeline #30334 passed
......@@ -89,7 +89,7 @@ func (T *Store) GetByID(ctx context.Context, id int) (*sig.Entry, error) {
}
func (T *Store) Search(ctx context.Context, page int, pageSize int, ordering store.Ordering, condition store.SearchCondition) (results []*sig.Entry, count int, err error) {
q := T.db.SQL()
q := T.db.WithContext(ctx).SQL()
sel := q.Select("*", db.Raw(`count(*) OVER() AS "count"`)).From(`4byte.entry`)
// by default we do exact signature comparison
......@@ -118,11 +118,13 @@ func (T *Store) Search(ctx context.Context, page int, pageSize int, ordering sto
op = "LIKE"
right = `'%' || ? || '%'`
condition.CaseSensitive = false
arg = strings.TrimPrefix(arg, "0x")
case store.SearchConditionEventHashContains:
left = "encode(event_hash, 'hex')"
op = "LIKE"
right = `'%' || ? || '%'`
condition.CaseSensitive = false
arg = strings.TrimPrefix(arg, "0x")
}
if !condition.CaseSensitive {
......@@ -130,7 +132,9 @@ func (T *Store) Search(ctx context.Context, page int, pageSize int, ordering sto
right = strings.ReplaceAll(right, "?", "LOWER(?)")
}
if condition.Type != store.SearchConditionNone {
sel = sel.Where(comparator(), arg)
}
switch ordering {
case store.OrderingCreatedAtAsc:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment