utils

package
v3.2.11 Latest Latest
Warning

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

Go to latest
Published: Jun 27, 2024 License: MIT Imports: 6 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetStructType

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

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

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

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

func NewNucleiJS(vm *goja.Runtime) *NucleiJS

NewNucleiJS creates a new nucleijs instance

func (*NucleiJS) GetArg

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

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

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

HandleError handles error and throws a

func (*NucleiJS) Require

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

Require throws an error if expression is false

func (*NucleiJS) Throw

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

Throw throws an error in goja runtime

func (*NucleiJS) ThrowError

func (j *NucleiJS) ThrowError(err error)

ThrowError throws an error in goja runtime if is not nil

type SQLResult

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