fix(storage,document,sqlite): fix nil pointer exception in query options
This commit is contained in:
parent
8789b85d92
commit
8680e139e7
|
@ -102,7 +102,7 @@ func (m *Module) query(call goja.FunctionCall, rt *goja.Runtime) goja.Value {
|
|||
}
|
||||
|
||||
if queryOptions.Offset != nil {
|
||||
queryOptionsFuncs = append(queryOptionsFuncs, storage.WithOffset(*queryOptions.Limit))
|
||||
queryOptionsFuncs = append(queryOptionsFuncs, storage.WithOffset(*queryOptions.Offset))
|
||||
}
|
||||
|
||||
if queryOptions.OrderDirection != nil {
|
||||
|
|
|
@ -127,7 +127,12 @@ func (s *DocumentStore) Query(ctx context.Context, collection string, filter *fi
|
|||
args = append([]interface{}{collection}, args...)
|
||||
|
||||
if opts.OrderBy != nil {
|
||||
query, args = withOrderByClause(query, args, *opts.OrderBy, *opts.OrderDirection)
|
||||
direction := storage.OrderDirectionAsc
|
||||
if opts.OrderDirection != nil {
|
||||
direction = *opts.OrderDirection
|
||||
}
|
||||
|
||||
query, args = withOrderByClause(query, args, *opts.OrderBy, direction)
|
||||
}
|
||||
|
||||
if opts.Offset != nil || opts.Limit != nil {
|
||||
|
|
Loading…
Reference in New Issue