database

package
v0.3.2 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetTools

func GetTools(db *gorm.DB, opts ...Option) []tool.BaseTool

GetTools 获取通用数据库工具列表

func NewDatabaseExecuteTool

func NewDatabaseExecuteTool(db *gorm.DB, opts ...Option) tool.InvokableTool

NewDatabaseExecuteTool 创建执行核心工具实例

Types

type DatabaseExecuteTool

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

DatabaseExecuteTool 数据库执行工具

type ExecuteParams

type ExecuteParams struct {
	Query  string        `json:"query" jsonschema:"description=要执行的SQL查询语句,required"`
	Params []interface{} `json:"params,omitempty" jsonschema:"description=查询参数(可选)"`
}

ExecuteParams 查询参数

type Option added in v0.3.0

type Option func(*DatabaseExecuteTool)

Option configures the database execution tool.

func WithAllowWrite added in v0.3.0

func WithAllowWrite(allow bool) Option

WithAllowWrite explicitly permits INSERT/UPDATE/DELETE/DDL statements. The tool is read-only by default.

func WithMaxResultRows added in v0.3.0

func WithMaxResultRows(max int) Option

WithMaxResultRows caps SELECT-like result sets.

func WithTimeout added in v0.3.0

func WithTimeout(timeout time.Duration) Option

WithTimeout adds a timeout around each SQL execution when positive.

Jump to

Keyboard shortcuts

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