data

package
v0.56.0 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2025 License: AGPL-3.0 Imports: 9 Imported by: 1

Documentation

Overview

Package data implements `k6/data` js module for k6. This modules provide utility types to work with data in an efficient way.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Data added in v0.36.0

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

Data represents an instance of the data module.

func (*Data) Exports added in v0.36.0

func (d *Data) Exports() modules.Exports

Exports returns the exports of the data module.

func (*Data) NewSharedArrayFrom added in v0.54.0

func (d *Data) NewSharedArrayFrom(rt *sobek.Runtime, name string, r RecordReader) *sobek.Object

NewSharedArrayFrom creates a new shared array from the provided data.

This function is not exposed to the JS runtime. It is used internally to instantiate shared arrays without having to go through the whole JS runtime machinery, which effectively has a big performance impact (e.g. when filling a shared array from a CSV file).

This function takes an explicit runtime argument to retain control over which VU runtime it is executed in. This is important because the shared array underlying implementation relies on maintaining a single instance of arrays for the whole test setup and VUs.

type RecordReader added in v0.54.0

type RecordReader interface {
	Read() ([]string, error)
}

RecordReader is the interface that wraps the action of reading records from a resource.

The data module RecordReader interface is implemented by types that can read data that can be treated as records, from data sources such as a CSV file, etc.

type RootModule added in v0.36.0

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

RootModule is the global module instance that will create module instances for each VU.

func New

func New() *RootModule

New returns a pointer to a new RootModule instance.

func (*RootModule) NewModuleInstance added in v0.36.0

func (rm *RootModule) NewModuleInstance(vu modules.VU) modules.Instance

NewModuleInstance implements the modules.Module interface to return a new instance for each VU.

Jump to

Keyboard shortcuts

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