Help us shape the future of Go! Take the 2026 Go Developer Survey

core

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2026 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Overview

Package core defines the core interfaces and types for CoreMCP database adapters.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ColumnInfo added in v0.2.0

type ColumnInfo struct {
	Name        string
	DataType    string
	IsNullable  bool
	Description string // Comment/Description from database
}

ColumnInfo represents detailed information about a table column.

type ForeignKey added in v0.2.0

type ForeignKey struct {
	ColumnName       string
	ReferencedTable  string
	ReferencedColumn string
	ConstraintName   string
}

ForeignKey represents a foreign key relationship.

type QueryResult

type QueryResult struct {
	Columns []string
	Rows    []map[string]any // (column_name: value)
}

QueryResult contains the results of a database query execution.

type Source

type Source interface {
	// Name returns the human-readable name of the database adapter.
	Name() string
	// Connect establishes a connection to the database.
	Connect(ctx context.Context) error
	// Close closes the database connection.
	Close(ctx context.Context) error
	// GetSchema retrieves the database schema information.
	GetSchema(ctx context.Context) ([]TableSchema, error)
	// ExecuteQuery runs a SQL query and returns the results.
	ExecuteQuery(ctx context.Context, query string, args ...any) (*QueryResult, error)
}

Source represents a database connection and query interface. All database adapters must implement this interface.

type TableSchema

type TableSchema struct {
	Name        string
	Columns     []ColumnInfo
	ForeignKeys []ForeignKey
	PrimaryKeys []string
}

TableSchema represents the structure of a database table.

Jump to

Keyboard shortcuts

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