simulation

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2025 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ResponseMetadata

type ResponseMetadata struct {
	Simulated bool   `json:"simulated"`
	Currency  string `json:"currency"`
	Ratio     int    `json:"conversion_ratio"`
}

ResponseMetadata contains simulation metadata

type SimulatedResponse

type SimulatedResponse struct {
	Data     []map[string]interface{} `json:"data"`
	Metadata ResponseMetadata         `json:"_metadata"`
}

SimulatedResponse represents a simulated API response

type Simulator

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

Simulator handles simulation mode for testing

func NewSimulator

func NewSimulator(cfg *config.Config) *Simulator

NewSimulator creates a new simulator

func (*Simulator) ShouldSimulate

func (s *Simulator) ShouldSimulate(simulateHeader string, clientIP string) bool

ShouldSimulate checks if simulation mode is enabled for this request

func (*Simulator) TransformResponse

func (s *Simulator) TransformResponse(rows *sql.Rows, tableName string) (*SimulatedResponse, error)

TransformResponse transforms database response to simulation format

Jump to

Keyboard shortcuts

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