Documentation
¶
Overview ¶
Package database 提供数据库查询工具
支持 SQL 数据库查询操作。
Index ¶
Constants ¶
View Source
const (
// DefaultMaxRows 默认最大返回行数,防止 OOM
DefaultMaxRows = 1000
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DatabaseTool ¶
type DatabaseTool struct {
// contains filtered or unexported fields
}
DatabaseTool 数据库工具
func NewDatabaseTool ¶
func NewDatabaseTool(db *sql.DB, opts ...Option) *DatabaseTool
NewDatabaseTool 创建数据库工具
type QueryInput ¶
type QueryInput struct {
SQL string `json:"sql" description:"SQL 查询语句"`
Params []any `json:"params,omitempty" description:"查询参数"`
}
QueryInput 查询输入
type QueryOutput ¶
type QueryOutput struct {
Columns []string `json:"columns"`
Rows [][]any `json:"rows"`
Count int `json:"count"`
}
QueryOutput 查询输出
func QuickQuery ¶
QuickQuery 快速查询辅助函数
Click to show internal directories.
Click to hide internal directories.