common

package
v0.7.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 19, 2019 License: MIT Imports: 12 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const RandomUserAgent = "*"

Variables

View Source
var (
	ErrReadOnly    = core.Error(core.ErrInvalidOperation, "read only")
	ErrInvalidPath = core.Error(core.ErrInvalidOperation, "invalid path")
)
View Source
var Attributes = []string{}/* 135 elements not displayed */

Functions

func DeserializeStyles added in v0.7.0

func DeserializeStyles(input values.String) (*values.Object, error)

func GetInDocument added in v0.7.0

func GetInDocument(ctx context.Context, doc drivers.HTMLDocument, path []core.Value) (core.Value, error)

func GetInElement added in v0.7.0

func GetInElement(ctx context.Context, el drivers.HTMLElement, path []core.Value) (core.Value, error)

func GetInNode added in v0.7.0

func GetInNode(ctx context.Context, node drivers.HTMLNode, path []core.Value) (core.Value, error)

func GetUserAgent

func GetUserAgent(val string) string

func IsAttribute

func IsAttribute(name string) bool

func NewIterator added in v0.7.0

func NewIterator(
	node drivers.HTMLElement,
) (core.Iterator, error)

func PathToString added in v0.7.0

func PathToString(path []core.Value) string

func SerializeStyles added in v0.7.0

func SerializeStyles(_ context.Context, styles *values.Object) values.String

func SetInDocument added in v0.7.0

func SetInDocument(ctx context.Context, doc drivers.HTMLDocument, path []core.Value, value core.Value) error

func SetInElement added in v0.7.0

func SetInElement(ctx context.Context, el drivers.HTMLElement, path []core.Value, value core.Value) error

func SetInNode added in v0.7.0

func SetInNode(_ context.Context, _ drivers.HTMLNode, path []core.Value, _ core.Value) error

func ToHTMLType

func ToHTMLType(nt html.NodeType) int

Types

type Iterator added in v0.7.0

type Iterator struct {
	// contains filtered or unexported fields
}

func (*Iterator) Next added in v0.7.0

func (iterator *Iterator) Next(ctx context.Context) (value core.Value, key core.Value, err error)

type LazyValue

type LazyValue struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func NewLazyValue

func NewLazyValue(factory LazyValueFactory) *LazyValue

func (*LazyValue) Read

func (lv *LazyValue) Read(ctx context.Context) (core.Value, error)

Read returns an underlying value. Not thread safe. Should not mutated. @returns (Value) - Underlying value if successfully loaded, otherwise error

func (*LazyValue) Ready

func (lv *LazyValue) Ready() bool

Ready indicates whether the value is ready. @returns (Boolean) - Boolean value indicating whether the value is ready.

func (*LazyValue) Reset

func (lv *LazyValue) Reset()

Reset resets the storage. Next call of Read will trigger the factory function again.

func (*LazyValue) Write

func (lv *LazyValue) Write(ctx context.Context, writer func(v core.Value, err error))

Write safely mutates an underlying value. Loads a value if it's not ready. Thread safe.

type LazyValueFactory added in v0.7.0

type LazyValueFactory func(ctx context.Context) (core.Value, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL