Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/community/pkgs/orm/gorm.md
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,7 @@ type AfterFindInterface interface {
下面是 gorm 支持的一些标签

| 标签名 | 说明 |
| :----------------------- | :----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --- |
| :----------------------- | :----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `column` | 指定 db 列名 |
| `type` | 列数据类型,推荐使用兼容性好的通用类型,例如:所有数据库都支持 bool、int、uint、float、string、time、bytes 并且可以和其他标签一起使用,例如:`not null`、`size`, `autoIncrement`… 像 `varbinary(8)` 这样指定数据库数据类型也是支持的。在使用指定数据库数据类型时,它需要是完整的数据库数据类型,如:`MEDIUMINT UNSIGNED not NULL AUTO_INCREMENT` |
| `serializer` | 指定将数据序列化或反序列化到数据库中的序列化器, 例如: `serializer:json/gob/unixtime` |
Expand All @@ -510,7 +510,7 @@ type AfterFindInterface interface {
| `<-` | 设置字段写入的权限, `<-:create` 只创建、`<-:update` 只更新、`<-:false` 无写入权限、`<-` 创建和更新权限 |
| `->` | 设置字段读的权限,`->:false` 无读权限 |
| `-` | 忽略该字段,`-` 表示无读写,`-:migration` 表示无迁移权限,`-:all` 表示无读写迁移权限 |
| `comment` | 迁移时为字段添加注释 | |
| `comment` | 迁移时为字段添加注释 |
| `foreignKey` | 指定当前模型的列作为连接表的外键 |
| `references` | 指定引用表的列名,其将被映射为连接表外键 |
| `polymorphic` | 指定多态类型,比如模型名 |
Expand Down