gotpl

package
v0.0.0-...-5e73e94 Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2020 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TypePrefix           = ""
	TypeSuffix           = ""
	EventMethodPrefix    = "Event"
	EventMethodSuffix    = ""
	CommandMethodPrefix  = "Command"
	CommandMethodSuffix  = ""
	EventTypePrefix      = "Event"
	EventTypeSuffix      = ""
	CommandTypePrefix    = ""
	CommandTypeSuffix    = "Params"
	CommandReturnsPrefix = ""
	CommandReturnsSuffix = "Returns"
	OptionFuncPrefix     = "With"
	OptionFuncSuffix     = ""

	// Base64EncodedParamName is the base64encoded variable name in command
	// return values when they are optionally base64 encoded.
	Base64EncodedParamName = "base64Encoded"

	// Base64EncodedDescriptionPrefix is the prefix for command return
	// description prefix when base64 encoded.
	Base64EncodedDescriptionPrefix = "Base64-encoded"

	// ChromeDevToolsDocBase is the base URL for the Chrome DevTools
	// documentation site.
	//
	// tot is "tip-of-tree"
	ChromeDevToolsDocBase = "https://chromedevtools.github.io/devtools-protocol/tot"
)

Prefix and suffix values.

Variables

This section is empty.

Functions

func ArgList

func ArgList(t *pdl.Type, d *pdl.Domain, domains []*pdl.Domain, all bool) string

ArgList returns the list of arguments. (only for non-optional params)

func Base64EncodedRetParam

func Base64EncodedRetParam(t *pdl.Type) *pdl.Type

Base64EncodedRetParam returns the base64 encoded return parameter, or nil if no parameters are base64 encoded.

func CamelName

func CamelName(t *pdl.Type) string

CamelName returns the CamelCase name of the type.

func CommandMethodType

func CommandMethodType(t *pdl.Type, d *pdl.Domain) string

CommandMethodType returns the method type of the event.

func CommandReturnsType

func CommandReturnsType(t *pdl.Type) string

CommandReturnsType returns the type of the command return type.

func CommandTemplate

func CommandTemplate(c *pdl.Type, d *pdl.Domain, domains []*pdl.Domain) string

func CommandType

func CommandType(t *pdl.Type) string

CommandType returns the type of the command.

func DocRefLink(t *pdl.Type) string

DocRefLink returns the reference documentation link for the type.

func DomainManagerTemplate

func DomainManagerTemplate(domains []*pdl.Domain) string

func DomainTemplate

func DomainTemplate(d *pdl.Domain, domains []*pdl.Domain) string

func EmptyRetList

func EmptyRetList(t *pdl.Type, d *pdl.Domain, domains []*pdl.Domain) string

EmptyRetList returns a list of the empty return values.

func EnumValueName

func EnumValueName(t *pdl.Type, v string) string

EnumValueName returns the name for a enum value.

func EventMethodType

func EventMethodType(t *pdl.Type, d *pdl.Domain) string

EventMethodType returns the method type of the event.

func EventType

func EventType(t *pdl.Type) string

EventType returns the type of the event.

func FileHeader

func FileHeader(pkgName string, d *pdl.Domain) string

func FileImportTemplate

func FileImportTemplate(importMap map[string]string) string

func GoEmptyValue

func GoEmptyValue(t *pdl.Type, d *pdl.Domain, domains []*pdl.Domain) string

GoEmptyValue returns the empty Go value for the type.

func GoEnumEmptyValue

func GoEnumEmptyValue(te pdl.TypeEnum) string

GoEnumEmptyValue returns the Go empty value for the TypeEnum.

func GoEnumType

func GoEnumType(te pdl.TypeEnum) string

GoEnumType returns the Go type for the TypeEnum.

func GoName

func GoName(t *pdl.Type, noExposeOverride bool) string

GoName returns the Go name.

func GoType

func GoType(t *pdl.Type, d *pdl.Domain, domains []*pdl.Domain) string

GoType returns the Go type for the type.

func GoTypeDef

func GoTypeDef(t *pdl.Type, d *pdl.Domain, domains []*pdl.Domain, extra []*pdl.Type, noExposeOverride, omitOnlyWhenOptional bool) string

GoTypeDef returns the Go type definition for the type.

func IsTypeOriginallyNilable

func IsTypeOriginallyNilable(t *pdl.Type, d *pdl.Domain, domains []*pdl.Domain) bool

IsTypeOriginallyNilable is a predicate.

func ParamDesc

func ParamDesc(t *pdl.Type) string

ParamDesc returns a parameter description.

func ParamList

func ParamList(t *pdl.Type, d *pdl.Domain, domains []*pdl.Domain, all bool) string

ParamList returns the list of parameters.

func ProtoName

func ProtoName(t *pdl.Type, d *pdl.Domain) string

ProtoName returns the protocol name of the type.

func ResolveRef

func ResolveRef(t *pdl.Type, d *pdl.Domain, domains []*pdl.Domain) (pdl.DomainType, *pdl.Type)

ResolveRef is a utility func to resolve the fully qualified name of a type's ref from the list of provided domains, relative to domain d when ref is not namespaced.

func ResolveType

func ResolveType(t *pdl.Type, d *pdl.Domain, domains []*pdl.Domain) (pdl.DomainType, *pdl.Type, string)

ResolveType resolves the type relative to the Go domain.

Returns the DomainType of the underlying type, the underlying type (or the original passed type if not a reference) and the fully qualified name type name.

func RetNameList

func RetNameList(t *pdl.Type, valname string, d *pdl.Domain, domains []*pdl.Domain) string

RetNameList returns a <valname>.<name> list for a command's return list.

func RetParamDesc

func RetParamDesc(t *pdl.Type) string

RetParamDesc returns a return parameter description.

func RetTypeList

func RetTypeList(t *pdl.Type, d *pdl.Domain, domains []*pdl.Domain) string

RetTypeList returns a list of the return types.

func StreamCommandTemplate

func StreamCommandTemplate(qw422016 *qt422016.Writer, c *pdl.Type, d *pdl.Domain, domains []*pdl.Domain)

func StreamDomainManagerTemplate

func StreamDomainManagerTemplate(qw422016 *qt422016.Writer, domains []*pdl.Domain)

func StreamDomainTemplate

func StreamDomainTemplate(qw422016 *qt422016.Writer, d *pdl.Domain, domains []*pdl.Domain)

func StreamFileHeader

func StreamFileHeader(qw422016 *qt422016.Writer, pkgName string, d *pdl.Domain)

func StreamFileImportTemplate

func StreamFileImportTemplate(qw422016 *qt422016.Writer, importMap map[string]string)

func StructDef

func StructDef(types []*pdl.Type, d *pdl.Domain, domains []*pdl.Domain, noExposeOverride, omitOnlyWhenOptional bool) string

StructDef returns a struct definition for a list of types.

func TypeName

func TypeName(t *pdl.Type, prefix, suffix string) string

TypeName returns the type name using the supplied prefix and suffix.

func WriteCommandTemplate

func WriteCommandTemplate(qq422016 qtio422016.Writer, c *pdl.Type, d *pdl.Domain, domains []*pdl.Domain)

func WriteDomainManagerTemplate

func WriteDomainManagerTemplate(qq422016 qtio422016.Writer, domains []*pdl.Domain)

func WriteDomainTemplate

func WriteDomainTemplate(qq422016 qtio422016.Writer, d *pdl.Domain, domains []*pdl.Domain)

func WriteFileHeader

func WriteFileHeader(qq422016 qtio422016.Writer, pkgName string, d *pdl.Domain)

func WriteFileImportTemplate

func WriteFileImportTemplate(qq422016 qtio422016.Writer, importMap map[string]string)

Types

This section is empty.

Jump to

Keyboard shortcuts

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