types

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2026 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ExpectChannel

type ExpectChannel string

ExpectChannel defines the type of expectation

const (
	HTTP            ExpectChannel = "HTTP"
	ReadMySQL       ExpectChannel = "READ_MYSQL"
	WriteMySQL      ExpectChannel = "WRITE_MYSQL"
	WritePostgreSQL ExpectChannel = "WRITE_POSTGRESQL"
	ReadPostgreSQL  ExpectChannel = "READ_POSTGRESQL"
	Event           ExpectChannel = "EVENT"
)

type ExpectStatement

type ExpectStatement struct {
	Channel       ExpectChannel
	Method        string // For HTTP
	URL           string // For HTTP
	Table         string // For DB
	Topic         string // For Kafka
	SQL           string // For DB (USING_SQL)
	WithFile      string // For Request Payload
	ReturnsFile   string // For Response Payload
	ReturnsEmpty  bool   // For DB (RETURNS EMPTY)
	NoTransaction bool   // For WRITE:MYSQL
	Verify        []VerifyRule
	Negative      bool              // If true, this should NOT be called
	BaseDir       string            // To resolve payload files
	Headers       map[string]string // For HTTP header matching
}

ExpectStatement defines an external dependency expectation

type Mock

type Mock interface {
	GetChannel() ExpectChannel
	GetName() string
	GetVerifyRules() []VerifyRule
}

Mock is the common interface for protocol-specific mocks

type ReceiveStatement

type ReceiveStatement struct {
	Channel  ExpectChannel
	Method   string
	Path     string
	WithFile string
	Headers  map[string]string
}

ReceiveStatement defines the trigger request

type RespondStatement

type RespondStatement struct {
	StatusCode int
	WithFile   string
	Noise      []string
}

RespondStatement defines the mock response for the trigger

type TestSpec

type TestSpec struct {
	Name       string
	FilePath   string
	BaseDir    string // Directory containing the .linespec and payloads/
	Receive    ReceiveStatement
	Expects    []ExpectStatement
	ExpectsNot []ExpectStatement
	Respond    RespondStatement
	Created    time.Time
}

TestSpec is the full AST for a .linespec file

type VerifyRule

type VerifyRule struct {
	Type    string // CONTAINS, NOT_CONTAINS, MATCHES
	Pattern string
}

VerifyRule defines a SQL verification rule

Jump to

Keyboard shortcuts

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