mirror of
https://gitee.com/johng/gf.git
synced 2024-12-02 04:07:47 +08:00
merge develop
This commit is contained in:
commit
2a350fd3ab
@ -142,9 +142,9 @@ func (d *DriverPgsql) TableFields(ctx context.Context, table string, schema ...s
|
||||
result Result
|
||||
link, err = d.SlaveLink(useSchema)
|
||||
structureSql = fmt.Sprintf(`
|
||||
SELECT a.attname AS field, t.typname AS type FROM pg_class c, pg_attribute a
|
||||
SELECT a.attname AS field, t.typname AS type,b.description as comment FROM pg_class c, pg_attribute a
|
||||
LEFT OUTER JOIN pg_description b ON a.attrelid=b.objoid AND a.attnum = b.objsubid,pg_type t
|
||||
WHERE c.relname = '%s' and a.attnum > 0 and a.attrelid = c.oid and a.atttypid = t.oid
|
||||
WHERE c.relname = '%s' and a.attnum > 0 and a.attrelid = c.oid and a.atttypid = t.oid
|
||||
ORDER BY a.attnum`,
|
||||
strings.ToLower(table),
|
||||
)
|
||||
@ -160,9 +160,10 @@ ORDER BY a.attnum`,
|
||||
fields = make(map[string]*TableField)
|
||||
for i, m := range result {
|
||||
fields[m["field"].String()] = &TableField{
|
||||
Index: i,
|
||||
Name: m["field"].String(),
|
||||
Type: m["type"].String(),
|
||||
Index: i,
|
||||
Name: m["field"].String(),
|
||||
Type: m["type"].String(),
|
||||
Comment: m["comment"].String(),
|
||||
}
|
||||
}
|
||||
return fields
|
||||
|
Loading…
Reference in New Issue
Block a user