function

package
v0.19.0 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2019 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrParseBlob is returned when the blob can't be parsed with bblfsh.
	ErrParseBlob = errors.NewKind("unable to parse the given blob using bblfsh: %s")

	// ErrUnmarshalUAST is returned when an error arises unmarshaling UASTs.
	ErrUnmarshalUAST = errors.NewKind("error unmarshaling UAST: %s")

	// ErrMarshalUAST is returned when an error arises marshaling UASTs.
	ErrMarshalUAST = errors.NewKind("error marshaling uast node: %s")
)
View Source
var Functions = sql.Functions{
	"is_tag":        sql.Function1(NewIsTag),
	"is_remote":     sql.Function1(NewIsRemote),
	"language":      sql.FunctionN(NewLanguage),
	"uast":          sql.FunctionN(NewUAST),
	"uast_mode":     sql.Function3(NewUASTMode),
	"uast_xpath":    sql.Function2(NewUASTXPath),
	"uast_extract":  sql.Function2(NewUASTExtract),
	"uast_children": sql.Function1(NewUASTChildren),
}

Functions for gitbase queries.

Functions

func NewIsRemote

func NewIsRemote(e sql.Expression) sql.Expression

NewIsRemote creates a new IsRemote function.

func NewIsTag

func NewIsTag(e sql.Expression) sql.Expression

NewIsTag creates a new IsTag function.

func NewLanguage added in v0.11.0

func NewLanguage(args ...sql.Expression) (sql.Expression, error)

NewLanguage creates a new Language UDF.

func NewUAST added in v0.11.0

func NewUAST(args ...sql.Expression) (sql.Expression, error)

NewUAST creates a new UAST UDF.

func NewUASTChildren added in v0.17.0

func NewUASTChildren(uast sql.Expression) sql.Expression

NewUASTChildren creates a new UASTExtract UDF.

func NewUASTExtract added in v0.17.0

func NewUASTExtract(uast, key sql.Expression) sql.Expression

NewUASTExtract creates a new UASTExtract UDF.

func NewUASTMode added in v0.16.0

func NewUASTMode(mode, blob, lang sql.Expression) sql.Expression

NewUASTMode creates a new UASTMode UDF.

func NewUASTXPath added in v0.11.0

func NewUASTXPath(uast, xpath sql.Expression) sql.Expression

NewUASTXPath creates a new UASTXPath UDF.

Types

type IsRemote

type IsRemote struct {
	expression.UnaryExpression
}

IsRemote checks the given string is a remote reference.

func (*IsRemote) Eval

func (f *IsRemote) Eval(ctx *sql.Context, row sql.Row) (interface{}, error)

Eval implements the expression interface.

func (IsRemote) String

func (f IsRemote) String() string

func (IsRemote) TransformUp

func (f IsRemote) TransformUp(fn sql.TransformExprFunc) (sql.Expression, error)

TransformUp implements the Expression interface.

func (IsRemote) Type

func (IsRemote) Type() sql.Type

Type implements the Expression interface.

type IsTag

type IsTag struct {
	expression.UnaryExpression
}

IsTag checks the given string is a tag name.

func (*IsTag) Eval

func (f *IsTag) Eval(ctx *sql.Context, row sql.Row) (interface{}, error)

Eval implements the expression interface.

func (IsTag) String

func (f IsTag) String() string

func (IsTag) TransformUp

func (f IsTag) TransformUp(fn sql.TransformExprFunc) (sql.Expression, error)

TransformUp implements the Expression interface.

func (IsTag) Type

func (IsTag) Type() sql.Type

Type implements the Expression interface.

type Language added in v0.11.0

type Language struct {
	Left  sql.Expression
	Right sql.Expression
}

Language gets the language of a file given its path and the optional content of the file.

func (*Language) Children added in v0.11.0

func (f *Language) Children() []sql.Expression

Children implements the Expression interface.

func (*Language) Eval added in v0.11.0

func (f *Language) Eval(ctx *sql.Context, row sql.Row) (interface{}, error)

Eval implements the Expression interface.

func (*Language) IsNullable added in v0.11.0

func (f *Language) IsNullable() bool

IsNullable implements the Expression interface.

func (*Language) Resolved added in v0.11.0

func (f *Language) Resolved() bool

Resolved implements the Expression interface.

func (*Language) String added in v0.11.0

func (f *Language) String() string

func (*Language) TransformUp added in v0.11.0

func (f *Language) TransformUp(fn sql.TransformExprFunc) (sql.Expression, error)

TransformUp implements the Expression interface.

func (Language) Type added in v0.11.0

func (Language) Type() sql.Type

Type implements the Expression interface.

type UAST added in v0.11.0

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

UAST returns an array of UAST nodes as blobs.

func (UAST) Children added in v0.11.0

func (u UAST) Children() []sql.Expression

Children implements the Expression interface.

func (UAST) Eval added in v0.11.0

func (u UAST) Eval(ctx *sql.Context, row sql.Row) (out interface{}, err error)

Eval implements the Expression interface.

func (UAST) IsNullable added in v0.11.0

func (u UAST) IsNullable() bool

IsNullable implements the Expression interface.

func (UAST) Resolved added in v0.11.0

func (u UAST) Resolved() bool

Resolved implements the Expression interface.

func (*UAST) String added in v0.11.0

func (u *UAST) String() string

String implements the Expression interface.

func (*UAST) TransformUp added in v0.11.0

func (u *UAST) TransformUp(fn sql.TransformExprFunc) (sql.Expression, error)

TransformUp implements the Expression interface.

func (UAST) Type added in v0.11.0

func (u UAST) Type() sql.Type

Type implements the Expression interface.

type UASTChildren added in v0.17.0

type UASTChildren struct {
	expression.UnaryExpression
}

UASTChildren returns children from UAST nodes.

func (*UASTChildren) Eval added in v0.17.0

func (u *UASTChildren) Eval(ctx *sql.Context, row sql.Row) (out interface{}, err error)

Eval implements the sql.Expression interface.

func (*UASTChildren) String added in v0.17.0

func (u *UASTChildren) String() string

String implements the fmt.Stringer interface.

func (*UASTChildren) TransformUp added in v0.17.0

func (u *UASTChildren) TransformUp(f sql.TransformExprFunc) (sql.Expression, error)

TransformUp implements the sql.Expression interface.

func (*UASTChildren) Type added in v0.17.0

func (u *UASTChildren) Type() sql.Type

Type implements the sql.Expression interface.

type UASTExtract added in v0.17.0

type UASTExtract struct {
	expression.BinaryExpression
}

UASTExtract extracts keys from an UAST.

func (*UASTExtract) Eval added in v0.17.0

func (u *UASTExtract) Eval(ctx *sql.Context, row sql.Row) (out interface{}, err error)

Eval implements the sql.Expression interface.

func (*UASTExtract) String added in v0.17.0

func (u *UASTExtract) String() string

String implements the fmt.Stringer interface.

func (*UASTExtract) TransformUp added in v0.17.0

func (u *UASTExtract) TransformUp(f sql.TransformExprFunc) (sql.Expression, error)

TransformUp implements the sql.Expression interface.

func (*UASTExtract) Type added in v0.17.0

func (u *UASTExtract) Type() sql.Type

Type implements the sql.Expression interface.

type UASTMode added in v0.16.0

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

UASTMode returns an array of UAST nodes as blobs.

func (UASTMode) Children added in v0.16.0

func (u UASTMode) Children() []sql.Expression

Children implements the Expression interface.

func (UASTMode) Eval added in v0.16.0

func (u UASTMode) Eval(ctx *sql.Context, row sql.Row) (out interface{}, err error)

Eval implements the Expression interface.

func (UASTMode) IsNullable added in v0.16.0

func (u UASTMode) IsNullable() bool

IsNullable implements the Expression interface.

func (UASTMode) Resolved added in v0.16.0

func (u UASTMode) Resolved() bool

Resolved implements the Expression interface.

func (*UASTMode) String added in v0.16.0

func (u *UASTMode) String() string

String implements the Expression interface.

func (*UASTMode) TransformUp added in v0.16.0

func (u *UASTMode) TransformUp(fn sql.TransformExprFunc) (sql.Expression, error)

TransformUp implements the Expression interface.

func (UASTMode) Type added in v0.16.0

func (u UASTMode) Type() sql.Type

Type implements the Expression interface.

type UASTXPath added in v0.11.0

type UASTXPath struct {
	expression.BinaryExpression
}

UASTXPath performs an XPath query over the given UAST nodes.

func (*UASTXPath) Eval added in v0.11.0

func (f *UASTXPath) Eval(ctx *sql.Context, row sql.Row) (out interface{}, err error)

Eval implements the Expression interface.

func (UASTXPath) String added in v0.11.0

func (f UASTXPath) String() string

func (UASTXPath) TransformUp added in v0.11.0

func (f UASTXPath) TransformUp(fn sql.TransformExprFunc) (sql.Expression, error)

TransformUp implements the Expression interface.

func (UASTXPath) Type added in v0.11.0

func (UASTXPath) Type() sql.Type

Type implements the Expression interface.

Jump to

Keyboard shortcuts

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