Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EscapeStringForSQL ¶
Types ¶
type ColumnInfo ¶
type ColumnInfo struct {
ColumnName string `db:"column_name"`
DataType string `db:"data_type"`
UdtName string `db:"udt_name"` // 实际数据类型名称
CharacterMaximumLength sql.NullInt64 `db:"character_maximum_length"` // 字符类型最大长度
NumericPrecision sql.NullInt64 `db:"numeric_precision"` // 数值精度
NumericScale sql.NullInt64 `db:"numeric_scale"` // 数值小数位数
DatetimePrecision sql.NullInt64 `db:"datetime_precision"` // 时间精度
ColumnDefault sql.NullString `db:"column_default"`
IsNullable string `db:"is_nullable"`
OrdinalPosition int `db:"ordinal_position"`
Attnum int `db:"attnum"` // 用于主键排序
Comment sql.NullString `db:"comment"` // 列注释(col_description)
}
type CommentInfo ¶
type CommentInfo struct {
ObjectType string `db:"obj_type"` // 'table' or 'column'
ObjectName string `db:"obj_name"` // table or column name
SubObjName string `db:"sub_obj"` // column name (if obj_type='table', this is empty)
Comment string `db:"comment"`
}
CommentInfo represents COMMENT for table or column
type EventInfo ¶
type EventInfo struct {
JobName string `db:"jobname"`
Schedule string `db:"schedule"`
Command string `db:"command"`
}
EventInfo 事件信息
type ForeignKeyDef ¶
type ForeignKeyDef struct {
ConstraintName string `db:"constraint_name"`
ColumnName string `db:"column_name"`
ReferencedTable string `db:"referenced_table"`
ReferencedColumn string `db:"referenced_column"`
}
ForeignKeyInfo represents a foreign key constraint
type FunctionInfo ¶
type FunctionInfo struct {
FuncDefinition string `db:"func_definition"`
}
FunctionInfo 函数信息
type IndexInfo ¶
type IndexInfo struct {
IndexName string `db:"index_name"`
IsUnique bool `db:"is_unique"`
IsPrimary bool `db:"is_primary"`
IndexDefinition string `db:"index_definition"`
}
IndexInfo represents an index on a table
type PostgreSQLExtraData ¶
type PostgreSQLExtraData struct {
EndMarks map[string]struct{}
DollarQuote string
InDollarQuote bool
// contains filtered or unexported fields
}
PostgreSQLExtraData implements the ExtraData interface for PostgreSQL
func (*PostgreSQLExtraData) InRawBlock ¶
func (e *PostgreSQLExtraData) InRawBlock() bool
InRawBlock 实现 dialect.RawBlockMarker:dollar-quote 内的内容是原样文本, 解析时应跳过字符串/注释处理。
func (*PostgreSQLExtraData) IsBlockEnd ¶
func (e *PostgreSQLExtraData) IsBlockEnd(line string) bool
IsBlockEnd 判断一行是否结束当前语句。 dollar-quote 的闭合检测集中在这里(逐行),与 word 回调(逐词打开)配合:
- 打开行:justOpened=true,跳过闭合检测(除非同一行标记出现 >=2 次,即单行 dollar-quote);
- 后续行:出现完整闭合标记则关闭并重置状态;
- 关闭后再按 EndMarks / 分号规则判定语句是否结束。
type PostgreSQLType ¶
type PostgreSQLType int
PostgreSQLType implements the SQLType interface for PostgreSQL
const ( PostgreSQLTypeUnknown PostgreSQLType = iota PostgreSQLTypeSelect PostgreSQLTypeInsert PostgreSQLTypeUpdate PostgreSQLTypeDelete PostgreSQLTypeCreateTable PostgreSQLTypeCreateIndex PostgreSQLTypeCreateView PostgreSQLTypeCreateFunction PostgreSQLTypeCreateProcedure PostgreSQLTypeCreateTrigger PostgreSQLTypeDrop PostgreSQLTypeAlter PostgreSQLTypeTransaction PostgreSQLTypeOther )
func (PostgreSQLType) AsInt ¶
func (t PostgreSQLType) AsInt() int
AsInt returns the integer representation of the SQL type
func (PostgreSQLType) IsBlock ¶
func (t PostgreSQLType) IsBlock() bool
IsBlock determines if the SQL type represents a block statement
func (PostgreSQLType) IsNull ¶
func (t PostgreSQLType) IsNull() bool
func (PostgreSQLType) String ¶
func (t PostgreSQLType) String() string
String returns the string representation of the SQL type
type PrimaryKeyInfo ¶
type PrimaryKeyInfo struct {
ColumnName string `db:"column_name"`
Attnum int `db:"attnum"` // 用于排序
}
PrimaryKeyInfo represents a primary key column
type ProcedureInfo ¶
type ProcedureInfo struct {
ProcDefinition string `db:"proc_definition"`
ProcName string `db:"proc_name"`
ProcKind string `db:"proc_kind"`
}
ProcedureInfo 存储过程信息
type TriggerInfo ¶
type TriggerInfo struct {
TriggerName string `db:"trigger_name"`
TriggerDefinition string `db:"trigger_definition"`
}
TriggerInfo 触发器信息