Auto Migration Migrator Interface CurrentDatabase Tables Columns Constraints Indexes Constraints Other Migration Tools Auto Migration Automatically migrate your schema, ...
注册序列化器 自定义序列化器类型 Serializer 是一个可扩展的接口,允许自定义如何使用数据库对数据进行序列化和反序列化 GORM 提供了一些默认的序列化器:json、gob、unixtime,这里有一个如何使用它的快速示例 type User struct { Name [] byte ...
Register Serializer Customized Serializer Type Serializer is an extensible interface that allows to customize how to serialize and deserialize data with databasae. GORM provide...
Callbacks Register Callback Delete Callback Replace Callback Register Callback with orders Defined Callbacks Plugin Callbacks GORM itself is powered by Callbacks , it has ...
1. Has One 1.1. Has One 1.2. 外键 1.3. 关联外键 1.4. 多态关联 1.5. 使用一对一 1. Has One 1.1. Has One has one 关联也是与另一个模型建立一对一的连接,但语义(和结果)有些不同。 此关联表示模型的每个实例包含或拥有另一个模型的一个实例。 例如,如果你的应用...
Delete a Record Delete with primary key Delete Hooks Batch Delete Block Global Delete Returning Data From Deleted Rows Soft Delete Find soft deleted records Delete permanent...