2024-10-16 17:24:50 +08:00
|
|
|
|
package sqlstmt
|
|
|
|
|
|
|
2026-05-08 20:45:13 +08:00
|
|
|
|
// TableRef 表示表引用
|
|
|
|
|
|
type TableRef struct {
|
|
|
|
|
|
Schema string // 数据库/模式名
|
|
|
|
|
|
Name string // 表名
|
|
|
|
|
|
Alias string // 别名
|
2024-10-16 17:24:50 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-05-08 20:45:13 +08:00
|
|
|
|
// FullName 返回完整表名(含 schema)
|
|
|
|
|
|
func (t TableRef) FullName() string {
|
|
|
|
|
|
if t.Schema != "" {
|
|
|
|
|
|
return t.Schema + "." + t.Name
|
|
|
|
|
|
}
|
|
|
|
|
|
return t.Name
|
2024-10-16 17:24:50 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-05-08 20:45:13 +08:00
|
|
|
|
// Expr 表示表达式(WHERE、ON、HAVING 等)
|
|
|
|
|
|
type Expr struct {
|
|
|
|
|
|
Text string // 原始表达式文本
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Limit LIMIT/OFFSET
|
|
|
|
|
|
type Limit struct {
|
|
|
|
|
|
Count int
|
|
|
|
|
|
Offset int
|
|
|
|
|
|
Text string
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// OrderByItem ORDER BY 项
|
|
|
|
|
|
type OrderByItem struct {
|
|
|
|
|
|
Text string
|
|
|
|
|
|
Desc bool
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Assignment SET 赋值
|
|
|
|
|
|
type Assignment struct {
|
|
|
|
|
|
Column string
|
|
|
|
|
|
Value *Expr
|
|
|
|
|
|
Text string
|
|
|
|
|
|
}
|