Skip to content

Commit

Permalink
default primitive handling and address/hash filters
Browse files Browse the repository at this point in the history
  • Loading branch information
EasterTheBunny committed Dec 24, 2024
1 parent 9599ab2 commit cfb3232
Show file tree
Hide file tree
Showing 4 changed files with 718 additions and 1 deletion.
25 changes: 25 additions & 0 deletions pkg/solana/logpoller/orm.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (

"github.com/smartcontractkit/chainlink-common/pkg/logger"
"github.com/smartcontractkit/chainlink-common/pkg/sqlutil"
"github.com/smartcontractkit/chainlink-common/pkg/types/query"
)

type DSORM struct {
Expand Down Expand Up @@ -156,3 +157,27 @@ func (o *DSORM) SelectLogs(ctx context.Context, start, end int64, address Public
}
return logs, nil
}

func (o *DSORM) FilteredLogs(ctx context.Context, filter []query.Expression, limitAndSort query.LimitAndSort, _ string) ([]Log, error) {
qs, args, err := (&pgDSLParser{}).buildQuery(o.chainID, filter, limitAndSort)
if err != nil {
return nil, err
}

values, err := args.toArgs()
if err != nil {
return nil, err
}

query, sqlArgs, err := o.ds.BindNamed(qs, values)
if err != nil {
return nil, err
}

var logs []Log
if err = o.ds.SelectContext(ctx, &logs, query, sqlArgs...); err != nil {
return nil, err
}

return logs, nil
}
Loading

0 comments on commit cfb3232

Please sign in to comment.