utils

package
v3.3.2 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2024 License: MIT Imports: 6 Imported by: 7

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetStructType added in v3.2.0

func GetStructType[T any](nj *NucleiJS, args []goja.Value, index int, FuncSig string) T

GetStructType gets a type defined in go and passed as argument from goja runtime if not found throws error Donot use this unless you are accepting a struct type from constructor

func GetStructTypeSafe added in v3.2.0

func GetStructTypeSafe[T any](nj *NucleiJS, args []goja.Value, index int, defaultValue T) T

GetStructTypeSafe gets an type defined in go and passed as argument from goja runtime if not found returns default value Donot use this unless you are accepting a struct type from constructor

func LinkConstructor added in v3.2.0

func LinkConstructor[T any](call goja.ConstructorCall, vm *goja.Runtime, obj T) *goja.Object

LinkConstructor links a type with invocation doing this allows usage of instance of type in js

Types

type NucleiJS added in v3.2.0

type NucleiJS struct {
	ObjectSig string
	// contains filtered or unexported fields
}

NucleiJS is js bindings that handles goja runtime related issue and allows setting a defer statements to close resources

func NewNucleiJS added in v3.2.0

func NewNucleiJS(vm *goja.Runtime) *NucleiJS

NewNucleiJS creates a new nucleijs instance

func (*NucleiJS) GetArg added in v3.2.0

func (j *NucleiJS) GetArg(args []goja.Value, index int) any

GetArg returns argument at index from goja runtime if not found throws error

func (*NucleiJS) GetArgSafe added in v3.2.0

func (j *NucleiJS) GetArgSafe(args []goja.Value, index int, defaultValue any) any

GetArgSafe returns argument at index from goja runtime if not found returns default value

func (*NucleiJS) HandleError added in v3.2.0

func (j *NucleiJS) HandleError(err error, msg ...string)

HandleError handles error and throws a

func (*NucleiJS) Require added in v3.2.0

func (j *NucleiJS) Require(expr bool, msg string)

Require throws an error if expression is false

func (*NucleiJS) Throw added in v3.2.0

func (j *NucleiJS) Throw(format string, args ...interface{})

Throw throws an error in goja runtime

func (*NucleiJS) ThrowError added in v3.2.0

func (j *NucleiJS) ThrowError(err error)

ThrowError throws an error in goja runtime if is not nil

type SQLResult added in v3.1.9

type SQLResult struct {
	Count   int           // Count is the number of rows returned.
	Columns []string      // Columns is the slice of column names.
	Rows    []interface{} // Rows is a slice of row data, where each row is a map of column name to value.
}

SQLResult holds the result of a SQL query.

It contains the count of rows, the columns present, and the actual row data.

func UnmarshalSQLRows

func UnmarshalSQLRows(rows *sql.Rows) (*SQLResult, error)

UnmarshalSQLRows converts sql.Rows into a more structured SQLResult.

This function takes *sql.Rows as input and attempts to unmarshal the data into a SQLResult struct. It handles different SQL data types by using the appropriate sql.Null* types during scanning. It returns a pointer to a SQLResult or an error.

The function closes the sql.Rows when finished.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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