mirror of
https://github.com/MontFerret/ferret.git
synced 2025-07-13 01:20:35 +02:00
move examples into separeted dirs (#495)
This commit is contained in:
@ -1,26 +0,0 @@
|
|||||||
package main
|
|
||||||
|
|
||||||
import (
|
|
||||||
"context"
|
|
||||||
|
|
||||||
"github.com/MontFerret/ferret/pkg/compiler"
|
|
||||||
"github.com/MontFerret/ferret/pkg/drivers"
|
|
||||||
"github.com/MontFerret/ferret/pkg/drivers/cdp"
|
|
||||||
)
|
|
||||||
|
|
||||||
func run(q string) ([]byte, error) {
|
|
||||||
comp := compiler.New()
|
|
||||||
program := comp.MustCompile(q)
|
|
||||||
|
|
||||||
// create a root context
|
|
||||||
ctx := context.Background()
|
|
||||||
|
|
||||||
// we inform the driver to keep cookies between queries
|
|
||||||
ctx = drivers.WithContext(
|
|
||||||
ctx,
|
|
||||||
cdp.NewDriver(cdp.WithKeepCookies()),
|
|
||||||
drivers.AsDefault(),
|
|
||||||
)
|
|
||||||
|
|
||||||
return program.Run(ctx)
|
|
||||||
}
|
|
Reference in New Issue
Block a user