function

package
v0.20.0 Latest Latest
Warning

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

Go to latest
Published: May 29, 2019 License: Apache-2.0 Imports: 28 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.Function{
	sql.Function1{Name: "is_tag", Fn: NewIsTag},
	sql.Function1{Name: "is_remote", Fn: NewIsRemote},
	sql.FunctionN{Name: "language", Fn: NewLanguage},
	sql.FunctionN{Name: "loc", Fn: NewLOC},
	sql.FunctionN{Name: "uast", Fn: NewUAST},
	sql.Function3{Name: "uast_mode", Fn: NewUASTMode},
	sql.Function2{Name: "uast_xpath", Fn: NewUASTXPath},
	sql.Function2{Name: "uast_extract", Fn: NewUASTExtract},
	sql.Function1{Name: "uast_children", Fn: NewUASTChildren},
	sql.Function1{Name: "is_vendor", Fn: NewIsVendor},
}

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 NewIsVendor added in v0.20.0

func NewIsVendor(filePath sql.Expression) sql.Expression

NewIsVendor creates a new IsVendor function.

func NewLOC added in v0.20.0

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

NewLOC creates a new LOC UDF.

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 IsVendor added in v0.20.0

type IsVendor struct {
	expression.UnaryExpression
}

IsVendor reports whether files are vendored or not.

func (*IsVendor) Eval added in v0.20.0

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

Eval implements the sql.Expression interface.

func (*IsVendor) String added in v0.20.0

func (v *IsVendor) String() string

func (*IsVendor) TransformUp added in v0.20.0

func (v *IsVendor) TransformUp(f sql.TransformExprFunc) (sql.Expression, error)

TransformUp implements the sql.Expression interface.

func (*IsVendor) Type added in v0.20.0

func (v *IsVendor) Type() sql.Type

Type implements the sql.Expression interface.

type LOC added in v0.20.0

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

func (*LOC) Children added in v0.20.0

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

Children implements the Expression interface.

func (*LOC) Eval added in v0.20.0

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

Eval implements the Expression interface.

func (*LOC) IsNullable added in v0.20.0

func (f *LOC) IsNullable() bool

IsNullable implements the Expression interface.

func (*LOC) Resolved added in v0.20.0

func (f *LOC) Resolved() bool

Resolved implements the Expression interface.

func (*LOC) String added in v0.20.0

func (f *LOC) String() string

func (*LOC) TransformUp added in v0.20.0

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

TransformUp implements the Expression interface.

func (LOC) Type added in v0.20.0

func (LOC) 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