postgresql

package
v0.9.2 Latest Latest
Warning

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

Go to latest
Published: Aug 30, 2026 License: MIT Imports: 8 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	DefaultPoolSize = 10
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ColumnInfo

type ColumnInfo struct {
	ColumnName string `json:"column_name"`
	DataType   string `json:"data_type"`
	NotNull    bool   `json:"not_null"`
	Default    string `json:"default,omitempty"`
}

type Config

type Config struct {
	ConnectionString string        `json:"connection_string"`
	PoolSize         int           `json:"pool_size"`
	StatementTimeout time.Duration `json:"statement_timeout"`
}

func DefaultConfig

func DefaultConfig() Config

type ExecuteResult

type ExecuteResult struct {
	CommandTag   string `json:"command_tag"`
	RowsAffected int64  `json:"rows_affected"`
}

type PostgresClient

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

func NewPostgresClient

func NewPostgresClient(logger *slog.Logger, cfg Config) (*PostgresClient, error)

func (*PostgresClient) CallTool

func (c *PostgresClient) CallTool(ctx context.Context, name string, args json.RawMessage) (interface{}, error)

func (*PostgresClient) Close

func (c *PostgresClient) Close()

func (*PostgresClient) GetTools

func (c *PostgresClient) GetTools() []ToolDefinition

type QueryResult

type QueryResult struct {
	Columns  []string                 `json:"columns"`
	Rows     []map[string]interface{} `json:"rows"`
	RowCount int64                    `json:"row_count"`
}

type TableInfo

type TableInfo struct {
	Schema      string `json:"schema"`
	Name        string `json:"name"`
	Type        string `json:"type"`
	RowEstimate int64  `json:"row_estimate,omitempty"`
}

type ToolDefinition

type ToolDefinition struct {
	Name        string          `json:"name"`
	Description string          `json:"description"`
	InputSchema json.RawMessage `json:"inputSchema"`
}

type ToolHandler

type ToolHandler func(ctx context.Context, args json.RawMessage) (interface{}, error)

Jump to

Keyboard shortcuts

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