Project

General

Profile

Golang API server » History » Version 2

Peter Amstutz, 08/09/2018 06:05 PM

1 1 Peter Amstutz
h1. Golang API server
2
3
https://github.com/go-ozzo/ozzo-validation
4 2 Peter Amstutz
5
Currently thinking about how to structure the callbacks that happen when updating and saving a record.
6
7
Types of callbacks:
8
9
* Fix-ups: modifying a column value, for example, stripping signatures from manifest_text
10
* Fill-ins: setting certain columns implies filling in another value (for example, setting portable_data_hash from manifest_text)
11
* Transitions: check that it semantically valid to go to record state Y from record state X (eg X and Y may both be valid, but going (X → Y) may not be valid)
12
* Permissions: check that the user making the request is allowed to make that modification
13
* Validations: check that a given record value is valid
14
15
Callbacks are very sensitive to ordering.  For example, a record may not pass Validation until a Fix-up has been applied.  Transition checks may occur before or after Fill-ins or Fix-ups.
16
17
Callback types have different contracts:
18
19
Fix-up and Fill-in operations potentially modify the update operation.  Transition and Permission validations rely on both the before and after state.  Plain Validation checks only look at the current state, but may apply to both create and update requests.