postgresql

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2026 License: MIT Imports: 8 Imported by: 0

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