Updated Modifiers (markdown)

Vinícius Garcia 2022-12-04 17:48:27 -03:00
parent bfae00c16f
commit 8cfd6cfa5f

@ -26,7 +26,7 @@ Modifiers improve on the `Valuer`/`Scanner` feature provided by the standard lib
- `json`: It will convert any type to JSON before writing to the database and unmarshal it back from JSON when reading, this makes it - `json`: It will convert any type to JSON before writing to the database and unmarshal it back from JSON when reading, this makes it
easy to save structs as JSON in the database if this fits your use-case. easy to save structs as JSON in the database if this fits your use-case.
- `timeNowUTC`: It only works if on attributes of type `time.Time` and it sets this attribute to `time.Now().UTC()` every time before insertions and updates. This modifier was created to be used on `UpdatedAt` timestamp fields. - `timeNowUTC`: It only work on attributes of type `time.Time` and it sets this attribute to `time.Now().UTC()` every time before insertions and updates. This modifier was created to be used on `UpdatedAt` timestamp fields.
- `timeNowUTC/skipUpdates`: Does the same as the above but only on insertions, during Updates attributes marked with this modifier will be completely ignored. This is useful for `CreatedAt` fields where you only want them to be set once when first creating the record. - `timeNowUTC/skipUpdates`: Does the same as the above but only on insertions, during Updates attributes marked with this modifier will be completely ignored. This is useful for `CreatedAt` fields where you only want them to be set once when first creating the record.
- `skipUpdates`: Will ignore fields on updates. - `skipUpdates`: Will ignore fields on updates.
- `skipInserts`: Will ignore fields on inserts. - `skipInserts`: Will ignore fields on inserts.