1、根据类全名定位对应类型id
select local_id,fullname from ubf_md_class where fullname like '命名空间'
2、根据类型id定位对应数据表字段属性
select local_id,local_class_id,name,length from ubf_md_attr...
我就废话不多说了,大家还是直接看代码吧~
type animal struct {
id int64
name string `gorm:"default:'galeone'"`
age int64
}
把 name 设置上缺省值 galeone 了。
补充:golang 巧用构造函数设置结构体...
查询格式:
select
c.relname 表名称,
a.attname as 字段名称,
col_description(a.attrelid,a.attnum) as 注释,
format_type ( a.atttypid, a.atttypmod ) as 类型,
case when a.attnotnull='f' then '否'...