Documentation
¶
Overview ¶
Package mock provides mock data sources for testing and development.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CompileOptions ¶
type CompileOptions struct {
ConfigDir string
Helpers *js.CompiledHelpers
ValueParser *ValueParser // Global CSV value parser
}
CompileOptions contains options for compiling mock sources.
type Source ¶
type Source interface {
// Data returns the mock data.
// For JS: executes the function with ctx, sql, input, tc (transform context)
// For static sources: returns the pre-parsed data (ctx unchanged, tc ignored)
Data(ctx map[string]any, sql string, input map[string]any, tc *js.TransformContext) (any, map[string]any, error)
}
Source represents a mock data source.
type ValueParser ¶
type ValueParser struct {
// contains filtered or unexported fields
}
ValueParser parses CSV cell values using custom JavaScript.
func CompileValueParser ¶
func CompileValueParser(jsCode string, helpers *js.CompiledHelpers) (*ValueParser, error)
CompileValueParser compiles a custom value parser from inline JavaScript code.
Click to show internal directories.
Click to hide internal directories.