13 lines
231 B
Go
13 lines
231 B
Go
|
package lexpr
|
||
|
|
||
|
import "context"
|
||
|
|
||
|
func (l *Lexpr) OneResult(ctx context.Context, expression string) (any, error) {
|
||
|
select {
|
||
|
case r := <-l.Eval(ctx, expression):
|
||
|
return r.Value, r.Error
|
||
|
case <-ctx.Done():
|
||
|
return nil, nil
|
||
|
}
|
||
|
}
|