values

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Dec 25, 2018 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultTimeLayout = time.RFC3339

Variables

View Source
var EmptyString = String("")
View Source
var False = Boolean(false)
View Source
var None = &none{}
View Source
var SpaceString = String(" ")
View Source
var True = Boolean(true)
View Source
var ZeroDateTime = DateTime{
	time.Time{},
}
View Source
var ZeroFloat = Float(0.0)
View Source
var ZeroInt = Int(0)

Functions

func GetIn

func GetIn(from core.Value, byPath []core.Value) (core.Value, error)

func IsHTMLScreenshotFormatValid added in v0.6.0

func IsHTMLScreenshotFormatValid(format string) bool

func MapHash added in v0.5.0

func MapHash(input map[string]core.Value) uint64

func Parse

func Parse(input interface{}) core.Value

func SetIn

func SetIn(to core.Value, byPath []core.Value, value core.Value) error

func ToArray added in v0.4.0

func ToArray(input core.Value) core.Value

func ToBoolean

func ToBoolean(input core.Value) core.Value

func Unmarshal

func Unmarshal(value json.RawMessage) (core.Value, error)

Types

type Array

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

func NewArray

func NewArray(size int) *Array

func NewArrayWith

func NewArrayWith(values ...core.Value) *Array

func (*Array) Clone

func (t *Array) Clone() core.Cloneable

func (*Array) Compare

func (t *Array) Compare(other core.Value) int

func (*Array) Copy

func (t *Array) Copy() core.Value

func (*Array) ForEach

func (t *Array) ForEach(predicate ArrayPredicate)

func (*Array) Get

func (t *Array) Get(idx Int) core.Value

func (*Array) Hash

func (t *Array) Hash() uint64

func (*Array) IndexOf

func (t *Array) IndexOf(item core.Value) Int

func (*Array) Insert

func (t *Array) Insert(idx Int, value core.Value)

func (*Array) Length

func (t *Array) Length() Int

func (*Array) MarshalJSON

func (t *Array) MarshalJSON() ([]byte, error)

func (*Array) Push

func (t *Array) Push(item core.Value)

func (*Array) RemoveAt

func (t *Array) RemoveAt(idx Int)

func (*Array) Set

func (t *Array) Set(idx Int, value core.Value) error

func (*Array) Slice

func (t *Array) Slice(from, to Int) *Array

func (*Array) Sort

func (t *Array) Sort() *Array

func (*Array) SortWith added in v0.5.0

func (t *Array) SortWith(sorter ArraySorter) *Array

func (*Array) String

func (t *Array) String() string

func (*Array) Type

func (t *Array) Type() core.Type

func (*Array) Unwrap

func (t *Array) Unwrap() interface{}

type ArrayPredicate

type ArrayPredicate = func(value core.Value, idx int) bool

type ArraySorter added in v0.5.0

type ArraySorter = func(first, second core.Value) bool

type Binary

type Binary []byte

func NewBinary

func NewBinary(values []byte) Binary

func NewBinaryFrom

func NewBinaryFrom(stream io.Reader) (Binary, error)

func (Binary) Compare

func (b Binary) Compare(other core.Value) int

func (Binary) Copy

func (b Binary) Copy() core.Value

func (Binary) Hash

func (b Binary) Hash() uint64

func (Binary) Length

func (b Binary) Length() Int

func (Binary) MarshalJSON

func (b Binary) MarshalJSON() ([]byte, error)

func (Binary) String

func (b Binary) String() string

func (Binary) Type

func (b Binary) Type() core.Type

func (Binary) Unwrap

func (b Binary) Unwrap() interface{}

type Boolean

type Boolean bool

func IsCloneable

func IsCloneable(value core.Value) Boolean

func IsInf

func IsInf(input Float, sign Int) Boolean

func IsNaN

func IsNaN(input Float) Boolean

func NewBoolean

func NewBoolean(input bool) Boolean

func ParseBoolean

func ParseBoolean(input interface{}) (Boolean, error)

func ParseBooleanP

func ParseBooleanP(input interface{}) Boolean

func (Boolean) Compare

func (t Boolean) Compare(other core.Value) int

func (Boolean) Copy

func (t Boolean) Copy() core.Value

func (Boolean) Hash

func (t Boolean) Hash() uint64

func (Boolean) MarshalJSON

func (t Boolean) MarshalJSON() ([]byte, error)

func (Boolean) String

func (t Boolean) String() string

func (Boolean) Type

func (t Boolean) Type() core.Type

func (Boolean) Unwrap

func (t Boolean) Unwrap() interface{}

type DHTMLDocument added in v0.6.0

type DHTMLDocument interface {
	HTMLDocument
	io.Closer

	Navigate(url String, timeout Int) error

	NavigateBack(skip Int, timeout Int) (Boolean, error)

	NavigateForward(skip Int, timeout Int) (Boolean, error)

	ClickBySelector(selector String) (Boolean, error)

	ClickBySelectorAll(selector String) (Boolean, error)

	InputBySelector(selector String, value core.Value, delay Int) (Boolean, error)

	SelectBySelector(selector String, value *Array) (*Array, error)

	HoverBySelector(selector String) error

	PrintToPDF(params HTMLPDFParams) (Binary, error)

	CaptureScreenshot(params HTMLScreenshotParams) (Binary, error)

	ScrollTop() error

	ScrollBottom() error

	ScrollBySelector(selector String) error

	WaitForNavigation(timeout Int) error

	WaitForSelector(selector String, timeout Int) error

	WaitForClass(selector, class String, timeout Int) error

	WaitForClassAll(selector, class String, timeout Int) error
}

DHTMLDocument is a Dynamic HTML Document

type DHTMLNode added in v0.6.0

type DHTMLNode interface {
	HTMLNode
	io.Closer

	Click() (Boolean, error)

	Input(value core.Value, delay Int) error

	Select(value *Array) (*Array, error)

	ScrollIntoView() error

	Hover() error

	WaitForClass(class String, timeout Int) error
}

type DateTime

type DateTime struct {
	time.Time
}

func NewCurrentDateTime

func NewCurrentDateTime() DateTime

func NewDateTime

func NewDateTime(time time.Time) DateTime

func ParseDateTime

func ParseDateTime(input interface{}) (DateTime, error)

func ParseDateTimeP

func ParseDateTimeP(input interface{}) DateTime

func ParseDateTimeWith

func ParseDateTimeWith(input interface{}, layout string) (DateTime, error)

func (DateTime) Compare

func (t DateTime) Compare(other core.Value) int

func (DateTime) Copy

func (t DateTime) Copy() core.Value

func (DateTime) Hash

func (t DateTime) Hash() uint64

func (DateTime) MarshalJSON

func (t DateTime) MarshalJSON() ([]byte, error)

func (DateTime) String

func (t DateTime) String() string

func (DateTime) Type

func (t DateTime) Type() core.Type

func (DateTime) Unwrap

func (t DateTime) Unwrap() interface{}

type Float

type Float float64

func NewFloat

func NewFloat(input float64) Float

func ParseFloat

func ParseFloat(input interface{}) (Float, error)

func ParseFloatP

func ParseFloatP(input interface{}) Float

func (Float) Compare

func (t Float) Compare(other core.Value) int

func (Float) Copy

func (t Float) Copy() core.Value

func (Float) Hash

func (t Float) Hash() uint64

func (Float) MarshalJSON

func (t Float) MarshalJSON() ([]byte, error)

func (Float) String

func (t Float) String() string

func (Float) Type

func (t Float) Type() core.Type

func (Float) Unwrap

func (t Float) Unwrap() interface{}

type HTMLDocument

type HTMLDocument interface {
	HTMLNode

	URL() core.Value
}

HTMLDocument is a HTML Document

type HTMLNode

type HTMLNode interface {
	core.Value

	NodeType() Int

	NodeName() String

	Length() Int

	InnerText() String

	InnerHTML() String

	Value() core.Value

	GetAttributes() core.Value

	GetAttribute(name String) core.Value

	GetChildNodes() core.Value

	GetChildNode(idx Int) core.Value

	QuerySelector(selector String) core.Value

	QuerySelectorAll(selector String) core.Value

	InnerHTMLBySelector(selector String) String

	InnerHTMLBySelectorAll(selector String) *Array

	InnerTextBySelector(selector String) String

	InnerTextBySelectorAll(selector String) *Array

	CountBySelector(selector String) Int

	ExistsBySelector(selector String) Boolean
}

HTMLNode is a HTML Node

type HTMLPDFParams added in v0.6.0

type HTMLPDFParams struct {
	// Paper orientation. Defaults to false.
	Landscape Boolean
	// Display header and footer. Defaults to false.
	DisplayHeaderFooter Boolean
	// Print background graphics. Defaults to false.
	PrintBackground Boolean
	// Scale of the webpage rendering. Defaults to 1.
	Scale Float
	// Paper width in inches. Defaults to 8.5 inches.
	PaperWidth Float
	// Paper height in inches. Defaults to 11 inches.
	PaperHeight Float
	// Top margin in inches. Defaults to 1cm (~0.4 inches).
	MarginTop Float
	// Bottom margin in inches. Defaults to 1cm (~0.4 inches).
	MarginBottom Float
	// Left margin in inches. Defaults to 1cm (~0.4 inches).
	MarginLeft Float
	// Right margin in inches. Defaults to 1cm (~0.4 inches).
	MarginRight Float
	// Paper ranges to print, e.g., '1-5, 8, 11-13'. Defaults to the empty string, which means print all pages.
	PageRanges String
	// Whether to silently ignore invalid but successfully parsed page ranges, such as '3-2'. Defaults to false.
	IgnoreInvalidPageRanges Boolean
	// HTML template for the print header. Should be valid HTML markup with following classes used to inject printing values into them: - `date`: formatted print date - `title`: document title - `url`: document location - `pageNumber`: current page number - `totalPages`: total pages in the document
	// For example, `<span class=title></span>` would generate span containing the title.
	HeaderTemplate String
	// HTML template for the print footer. Should use the same format as the `headerTemplate`.
	FooterTemplate String
	// Whether or not to prefer page size as defined by css.
	// Defaults to false, in which case the content will be scaled to fit the paper size.
	PreferCSSPageSize Boolean
}

HTMLPDFParams represents the arguments for PrintToPDF function.

func NewDefaultHTMLPDFParams added in v0.6.0

func NewDefaultHTMLPDFParams() HTMLPDFParams

type HTMLScreenshotFormat added in v0.6.0

type HTMLScreenshotFormat string
const (
	HTMLScreenshotFormatPNG  HTMLScreenshotFormat = "png"
	HTMLScreenshotFormatJPEG HTMLScreenshotFormat = "jpeg"
)

type HTMLScreenshotParams added in v0.6.0

type HTMLScreenshotParams struct {
	X       Float
	Y       Float
	Width   Float
	Height  Float
	Format  HTMLScreenshotFormat
	Quality Int
}

type Int

type Int int64

func NewInt

func NewInt(input int) Int

func ParseInt

func ParseInt(input interface{}) (Int, error)

func ParseIntP

func ParseIntP(input interface{}) Int

func (Int) Compare

func (t Int) Compare(other core.Value) int

func (Int) Copy

func (t Int) Copy() core.Value

func (Int) Hash

func (t Int) Hash() uint64

func (Int) MarshalJSON

func (t Int) MarshalJSON() ([]byte, error)

func (Int) String

func (t Int) String() string

func (Int) Type

func (t Int) Type() core.Type

func (Int) Unwrap

func (t Int) Unwrap() interface{}

type Object

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

func NewObject

func NewObject() *Object

func NewObjectWith

func NewObjectWith(props ...*ObjectProperty) *Object

func (*Object) Clone

func (t *Object) Clone() core.Cloneable

func (*Object) Compare

func (t *Object) Compare(other core.Value) int

Compare compares the source object with other core.Value The behavior of the Compare is similar to the comparison of objects in ArangoDB

func (*Object) Copy

func (t *Object) Copy() core.Value

func (*Object) ForEach

func (t *Object) ForEach(predicate ObjectPredicate)

func (*Object) Get

func (t *Object) Get(key String) (core.Value, Boolean)

func (*Object) GetIn

func (t *Object) GetIn(path []core.Value) (core.Value, error)

func (*Object) Hash

func (t *Object) Hash() uint64

func (*Object) Keys

func (t *Object) Keys() []string

func (*Object) Length

func (t *Object) Length() Int

func (*Object) MarshalJSON

func (t *Object) MarshalJSON() ([]byte, error)

func (*Object) Remove

func (t *Object) Remove(key String)

func (*Object) Set

func (t *Object) Set(key String, value core.Value)

func (*Object) SetIn

func (t *Object) SetIn(path []core.Value, value core.Value) error

func (*Object) String

func (t *Object) String() string

func (*Object) Type

func (t *Object) Type() core.Type

func (*Object) Unwrap

func (t *Object) Unwrap() interface{}

type ObjectPredicate

type ObjectPredicate = func(value core.Value, key string) bool

type ObjectProperty

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

func NewObjectProperty

func NewObjectProperty(name string, value core.Value) *ObjectProperty

type String

type String string

func NewString

func NewString(input string) String

func NewStringFromRunes

func NewStringFromRunes(input []rune) String

func ParseString

func ParseString(input interface{}) (String, error)

func ParseStringP

func ParseStringP(input interface{}) String

func (String) Compare

func (t String) Compare(other core.Value) int

func (String) Concat

func (t String) Concat(other core.Value) String

func (String) Contains

func (t String) Contains(other String) Boolean

func (String) Copy

func (t String) Copy() core.Value

func (String) Hash

func (t String) Hash() uint64

func (String) IndexOf

func (t String) IndexOf(other String) Int

func (String) Length

func (t String) Length() Int

func (String) MarshalJSON

func (t String) MarshalJSON() ([]byte, error)

func (String) String

func (t String) String() string

func (String) Type

func (t String) Type() core.Type

func (String) Unwrap

func (t String) Unwrap() interface{}

Jump to

Keyboard shortcuts

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