pkg

package
v0.0.24 Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2025 License: Apache-2.0 Imports: 30 Imported by: 0

Documentation

Overview

Copyright 2023-2024 API Testing Authors.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright 2025 API Testing Authors.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright 2025 API Testing Authors.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright 2023-2025 API Testing Authors.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright 2025 API Testing Authors.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright 2025 API Testing Authors.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

View Source
const (
	InnerSelectTable_      = "@selectTable_"
	InnerSelectTableLimit_ = "@selectTableLImit100_"
	InnerDescribeTable_    = "@describeTable_"
	InnerShowDatabases     = "@showDatabases"
	InnerShowTables        = "@showTables"
	InnerCurrentDB         = "@currentDB"
)
View Source
const (
	DialectorPostgres = "postgres"
	DialectorMySQL    = "mysql"
)

Variables

This section is empty.

Functions

func ConvertHistoryToRemoteTestCase added in v0.0.11

func ConvertHistoryToRemoteTestCase(historyTestcase *HistoryTestResult) (result *server.TestCase)

func ConvertToGRPCHistoryTestCase added in v0.0.11

func ConvertToGRPCHistoryTestCase(historyTestResult *HistoryTestResult) (result *server.HistoryTestCase)

func ConvertToGRPCHistoryTestSuite added in v0.0.11

func ConvertToGRPCHistoryTestSuite(historyTestResult *HistoryTestResult) (result *remote.HistoryTestSuite)

func ConvertToGRPCTestSuite

func ConvertToGRPCTestSuite(suite *TestSuite) (result *remote.TestSuite)

func ConvertToRemoteHistoryTestResult added in v0.0.11

func ConvertToRemoteHistoryTestResult(historyTestResult *HistoryTestResult) (result *server.HistoryTestResult)

func ConvertToRemoteTestCase

func ConvertToRemoteTestCase(testcase *TestCase) (result *server.TestCase)

func NewRemoteServer

func NewRemoteServer(defaultHistoryLimit int) (s remote.LoaderServer)

NewRemoteServer creates a remote server instance

func NewTDengineDialector added in v0.0.16

func NewTDengineDialector(dsn string) gorm.Dialector

func SliceToJSON

func SliceToJSON(slice []string) (result string)

Types

type DBQuery added in v0.0.24

type DBQuery struct {
	SQL string `json:"sql" jsonschema:"the sql to be executed"`
}

type DataQuery added in v0.0.18

type DataQuery interface {
	GetDatabases(context.Context) (databases []string, err error)
	GetTables(ctx context.Context, currentDatabase string) (tables []string, err error)
	GetCurrentDatabase() (string, error)
	GetLabels(context.Context, string) []*server.Pair
	GetClient() *gorm.DB
	GetInnerSQL() InnerSQL
}

func NewCommonDataQuery added in v0.0.18

func NewCommonDataQuery(innerSQL InnerSQL, db *gorm.DB) DataQuery

type DatabaseQuery added in v0.0.24

type DatabaseQuery interface {
	Query(ctx context.Context, request *mcp.CallToolRequest, query DBQuery) (
		result *mcp.CallToolResult, a any, err error)
}

func NewMcpServer added in v0.0.24

func NewMcpServer(store *testing.Store) DatabaseQuery

type HistoryTestResult added in v0.0.11

type HistoryTestResult struct {
	ID               string `gorm:"primaryKey"`
	HistorySuiteName string
	CreateTime       string

	//suite information
	SuiteName string `json:"suiteName"`
	SuiteAPI  string
	SpecKind  string
	SpecURL   string
	Param     string

	//case information
	CaseName      string `json:"caseName"`
	CaseAPI       string
	Method        string
	Body          string
	Header        string
	HistoryHeader string
	Cookie        string
	Query         string
	Form          string

	ExpectStatusCode int
	ExpectBody       string
	ExpectSchema     string
	ExpectHeader     string
	ExpectBodyFields string
	ExpectVerify     string

	//result information
	Message    string `json:"message"`
	Error      string `json:"error"`
	StatusCode int32  `json:"statusCode"`
	Output     string `json:"output"`
}

func ConvertToDBHistoryTestResult added in v0.0.11

func ConvertToDBHistoryTestResult(historyTestResult *server.HistoryTestResult) (result *HistoryTestResult)

type InnerSQL added in v0.0.18

type InnerSQL interface {
	ToNativeSQL(query string) string
}

func GetInnerSQL added in v0.0.18

func GetInnerSQL(dialect string) InnerSQL

type TestCase

type TestCase struct {
	SuiteName string `json:"suiteName" gorm:"type:varchar(200);uniqueIndex:idx_name_and_suite_name"`
	Name      string `gorm:"type:varchar(200);uniqueIndex:idx_name_and_suite_name"`
	API       string
	Method    string
	Body      string
	Header    string
	Cookie    string
	Query     string
	Form      string

	ExpectStatusCode int
	ExpectBody       string
	ExpectSchema     string
	ExpectHeader     string
	ExpectBodyFields string
	ExpectVerify     string
}

func ConverToDBTestCase

func ConverToDBTestCase(testcase *server.TestCase) (result *TestCase)

type TestSuite

type TestSuite struct {
	Name     string `gorm:"primaryKey"`
	API      string
	SpecKind string
	SpecURL  string
	Param    string
}

func ConvertToDBTestSuite

func ConvertToDBTestSuite(suite *remote.TestSuite) (result *TestSuite)

Jump to

Keyboard shortcuts

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