pdl

package
v0.0.0-...-99c9ca1 Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2020 License: MIT Imports: 8 Imported by: 3

Documentation

Overview

Package pdl contains types and funcs for working with Chrome DevTools Protocol definitions (ie, PDL files).

Index

Constants

View Source
const HAR = `` /* 11459-byte string literal not displayed */

HAR is the PDL formatted definition of HTTP Archive (HAR) types.

Variables

This section is empty.

Functions

func CombineBytes

func CombineBytes(buffers ...[]byte) ([]byte, error)

CombineBytes combines domains from multiple PDL definitions into a single PDL.

func IsCircularDep

func IsCircularDep(dtyp, typ string) bool

IsCircularDep returns whether or not a type will cause circular dependency issues. Useful for generating Go packages.

Types

type Domain

type Domain struct {
	// Domain is the name of the domain.
	Domain DomainType

	// Description is the domain description.
	Description string

	// Experimental indicates whether or not the domain is experimental.
	Experimental bool

	// Deprecated indicates whether or not the domain is deprecated.
	Deprecated bool

	// Dependencies are the domains' dependencies.
	Dependencies []string

	// Types are the list of types in the domain.
	Types []*Type

	// Commands are the list of commands in the domain.
	Commands []*Type

	// Events is the list of events types in the domain.
	Events []*Type
}

Domain represents a Chrome DevTools Protocol domain.

type DomainType

type DomainType string

DomainType is the Chrome domain type.

func (DomainType) String

func (dt DomainType) String() string

String satisfies Stringer.

type PDL

type PDL struct {
	// Copyright is the file copyright.
	Copyright string

	// Version is the file version information.
	Version *Version

	// Domains are the available domains.
	Domains []*Domain
}

PDL contains information about the domains, types, commands, and events of the Chrome DevTools Protocol.

func Combine

func Combine(pdls ...*PDL) *PDL

Combine combines domains from multiple PDL definitions into a single PDL.

func LoadFile

func LoadFile(filename string) (*PDL, error)

LoadFile loads a PDL file from the specified filename.

func Parse

func Parse(buf []byte) (*PDL, error)

Parse parses a PDL file contained in buf.

Rewrite of the Python script from the Chromium source tree.

See: $CHROMIUM_SOURCE/third_party/inspector_protocol/pdl.py Rev: a42a629f67ac9aae0aaa8fbd912c654559c5d880

func (*PDL) Bytes

func (pdl *PDL) Bytes() []byte

Bytes generates file contents for the PDL.

type Redirect

type Redirect struct {
	// Domain is the domain to redirect to.
	Domain DomainType

	// Name is the name of the command, event, or type to redirect to.
	Name string
}

Redirect holds type redirect information.

func (Redirect) String

func (r Redirect) String() string

String satisfies the fmt.Stringer interface.

type TimestampType

type TimestampType int

TimestampType are the various timestamp subtypes.

const (
	TimestampTypeMillisecond TimestampType = 1 + iota
	TimestampTypeSecond
	TimestampTypeMonotonic
)

TimestampType values.

type Type

type Type struct {
	// Type is the base type of the type.
	Type TypeEnum

	// Name is the name of the type.
	Name string

	// Description is the type description.
	Description string

	// Experimental indicates whether or not the type is experimental.
	Experimental bool

	// Deprecated indicates if the type is deprecated. Used for commands and event parameters.
	Deprecated bool

	// Optional indicates whether or not the type is optional.
	Optional bool

	// Ref is the type the object refers to.
	Ref string

	// Items is the contained type for arrays.
	Items *Type

	// Parameters are object parameters for commands or events.
	Parameters []*Type

	// Returns are the return values for commands.
	Returns []*Type

	// Properties are object properties.
	Properties []*Type

	// Redirect is a type to redirect to, if any.
	Redirect *Redirect

	// Enum are string enum values.
	Enum []string

	// RawType is the raw type.
	RawType string `json:"-"`

	// RawName is the raw type name.
	RawName string `json:"-"`

	// RawSee is a raw see url reference.
	RawSee string `json:"-"`

	// TimestampType is the timestamp subtype.
	TimestampType TimestampType `json:"-"`

	// IsCircularDep indicates a type that causes circular dependencies.
	IsCircularDep bool `json:"-"`

	// NoExpose toggles whether or not to expose the type.
	NoExpose bool `json:"-"`

	// NoResolve toggles not resolving the type to a domain (ie, for special
	// internal types).
	NoResolve bool `json:"-"`

	// AlwaysEmit forces the value to always be emitted when marshaled to JSON.
	AlwaysEmit bool `json:"-"`

	// EnumValueNameMap is a map to override the generated enum value name.
	EnumValueNameMap map[string]string `json:"-"`

	// EnumBitMask toggles it as a bit mask enum for TypeInteger enums.
	EnumBitMask bool `json:"-"`

	// Extra will be added as output after the the type is emitted.
	Extra string `json:"-"`
}

Type represents a Chrome DevTools Protocol type.

type TypeEnum

type TypeEnum string

TypeEnum is the Chrome domain type enum.

const (
	TypeAny       TypeEnum = "any"
	TypeArray     TypeEnum = "array"
	TypeBinary    TypeEnum = "binary"
	TypeBoolean   TypeEnum = "boolean"
	TypeInteger   TypeEnum = "integer"
	TypeNumber    TypeEnum = "number"
	TypeObject    TypeEnum = "object"
	TypeString    TypeEnum = "string"
	TypeTimestamp TypeEnum = "timestamp"
)

TypeEnum values.

func (TypeEnum) String

func (te TypeEnum) String() string

String satisfies stringer.

type Version

type Version struct {
	// Major is the major version.
	Major int

	// Minor is the minor version.
	Minor int
}

Version holds information for the the version Chrome DevTools Protocol definition.

Jump to

Keyboard shortcuts

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