mockservers

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package mockservers provides mock database servers for testing. These can be reused across driver tests and integration tests.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ResultSetMetaData

type ResultSetMetaData struct {
	NumRows int       `json:"numRows"`
	RowType []RowType `json:"rowType"`
}

ResultSetMetaData describes the result set columns.

type RowType

type RowType struct {
	Name     string `json:"name"`
	Type     string `json:"type"`
	Nullable bool   `json:"nullable"`
}

RowType describes a single column.

type SnowflakeResponse

type SnowflakeResponse struct {
	ResultSetMetaData *ResultSetMetaData `json:"resultSetMetaData,omitempty"`
	Data              [][]string         `json:"data,omitempty"`
	Code              string             `json:"code,omitempty"`
	Message           string             `json:"message,omitempty"`
	SQLState          string             `json:"sqlState,omitempty"`
}

SnowflakeResponse represents a Snowflake SQL API response.

type SnowflakeServer

type SnowflakeServer struct {
	Server *httptest.Server

	// Queries records all SQL statements received.
	Queries []string
	// CustomHandler allows overriding the default behavior per test.
	CustomHandler func(sql string) (*SnowflakeResponse, int)
	// contains filtered or unexported fields
}

SnowflakeServer is a mock Snowflake SQL REST API v2 server.

func NewSnowflakeServer

func NewSnowflakeServer() *SnowflakeServer

NewSnowflakeServer creates a mock Snowflake server with default table data.

func (*SnowflakeServer) Close

func (s *SnowflakeServer) Close()

Close shuts down the mock server.

func (*SnowflakeServer) URL

func (s *SnowflakeServer) URL() string

URL returns the base URL of the mock server.

Jump to

Keyboard shortcuts

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