Documentation ¶
Index ¶
- Variables
- func IsTruthy(a any) bool
- func JSONVal(o any) pongo2.Context
- func MergeTemplateContexts(c ...pongo2.Context) pongo2.Context
- func NodeToTemplate(node *html.Node) *v1beta1.HTMLNodeTemplateData
- func ProtoJSONVal(msg proto.Message) pongo2.Context
- func UpdateHTML(doc *goquery.Selection, sel DOMQuery, u UpdateHTMLFunc) error
- func UpdateHTMLString(html string, sel DOMQuery, u UpdateHTMLFunc) (*goquery.Selection, error)
- type Browser
- type Context
- func (c *Context) Copy() *Context
- func (c *Context) RefreshPageState() error
- func (c *Context) SaveHTML(_ context.Context, fp, content string) error
- func (c *Context) Screenshot(ctx context.Context, name string) (string, error)
- func (c *Context) WithContext(ctx context.Context) *Context
- func (c *Context) WithTimeout(to time.Duration) (*Context, context.CancelFunc)
- type ContextOpts
- type DOMDataWriter
- type DOMQuery
- type EachSelector
- type EvalHandle
- type Evaluator
- type Event
- type EventQueue
- type Instruction
- type NextInstructionEvent
- type PathNode
- type StringSelector
- type TemplateData
- type TemplateRenderer
- type UpdateHTMLFunc
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ProtoMarshaller = &protojson.MarshalOptions{ AllowPartial: true, } ProtoUnmarshaller = &protojson.UnmarshalOptions{ AllowPartial: true, DiscardUnknown: true, } )
View Source
var ( ErrRetryEval = errors.New("retry eval") ErrSkip = errors.New("skip eval") )
Functions ¶
func MergeTemplateContexts ¶
func MergeTemplateContexts(c ...pongo2.Context) pongo2.Context
func NodeToTemplate ¶
func NodeToTemplate(node *html.Node) *v1beta1.HTMLNodeTemplateData
func ProtoJSONVal ¶
func UpdateHTML ¶
func UpdateHTML(doc *goquery.Selection, sel DOMQuery, u UpdateHTMLFunc) error
func UpdateHTMLString ¶
Types ¶
type Browser ¶
type Browser interface { RefreshPage(ctx context.Context, content *string) error URL(ctx context.Context) (string, error) Exists(ctx context.Context, sel string) bool WriteInput(ctx context.Context, selector, content string) error Content(ctx context.Context, selector string) ([]*v1beta1.HTMLNodeTemplateData, error) }
func NewBrowser ¶
func NewBrowser() Browser
type Context ¶
type Context struct { context.Context TemplateData *TemplateData Stream renderer.Stream Evaluator Evaluator Browser Browser // contains filtered or unexported fields }
func NewContext ¶
func (*Context) RefreshPageState ¶
func (*Context) Screenshot ¶
func (*Context) WithTimeout ¶
type ContextOpts ¶
type DOMDataWriter ¶
type DOMDataWriter interface {
GetQueries() []DOMQuery
}
DOMDataWriter represents anything that writes data into the DOM. Something like a mouse click, is not a DOMDataWriter.
type EachSelector ¶
type EachSelector struct {
*v1beta1.EachSelector
}
func NewEachSelector ¶
func NewEachSelector(c *v1beta1.EachSelector) *EachSelector
type EvalHandle ¶
type EvalHandle interface { Cancel(err error) Done() <-chan struct{} Err() error // Cause can be nil if the context is Done but no error occurred. Cause() error Instruction() Instruction }
func EvalAsync ¶
func EvalAsync(c *Context, act Instruction, to time.Duration) EvalHandle
type Evaluator ¶
type Evaluator interface {
Eval(c *Context, i Instruction) EvalHandle
}
Evaluator evaluates and tracks Instruction's that have been previously evaluated.
func NewEvaluator ¶
func NewEvaluator(eq EventQueue, to time.Duration) Evaluator
type Instruction ¶
Instruction is an individual pieces of work to be evaluated at runtime. Every Instruction should have their Eval method called via the Evaluator rather than calling it directly.
type NextInstructionEvent ¶
type NextInstructionEvent struct { // The Instruction that is now running. Instruction Instruction Context *Context }
func (*NextInstructionEvent) String ¶
func (c *NextInstructionEvent) String() string
type StringSelector ¶
type StringSelector string
func (StringSelector) Query ¶
func (s StringSelector) Query(doc *goquery.Selection) []*goquery.Selection
func (StringSelector) String ¶
func (s StringSelector) String() string
type TemplateData ¶
type TemplateData struct {
*v1beta1.ScriptTemplateData
}
func (*TemplateData) Copy ¶
func (t *TemplateData) Copy() *TemplateData
func (*TemplateData) ForEach ¶
func (t *TemplateData) ForEach(key string, f func(r *TemplateData))
func (*TemplateData) GetStepVal ¶
func (t *TemplateData) GetStepVal(id string) string
func (*TemplateData) Merge ¶
func (t *TemplateData) Merge(m ...*TemplateData) *TemplateData
func (*TemplateData) SetStepVal ¶
func (t *TemplateData) SetStepVal(id, val string)
type TemplateRenderer ¶
type TemplateRenderer struct {
// contains filtered or unexported fields
}
func CompileTemplate ¶
func CompileTemplate(expr string) (*TemplateRenderer, error)
func (*TemplateRenderer) Render ¶
func (t *TemplateRenderer) Render(d *TemplateData) string
type UpdateHTMLFunc ¶
Click to show internal directories.
Click to hide internal directories.