You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Feb 8, 2024. It is now read-only.
At the moment, optional fields in structures are not implemented in vlang, but as far as I understand this is a matter of time. We can try to implement our own through generics:
structNone {}
typeOptError=string| None
structOpt<T> {
value T
error OptError= None{}
}
structMessageModify {
text Opt<string>
}
editQuery:= MessageModify{Opt<string>{value: 'Hello there!'})
// Then in rest method check every field error and serialize
Options will replace almost all fields in already written structures
or do nothing yet and wait for implementation in language
The text was updated successfully, but these errors were encountered:
Terisback
changed the title
Idea how to realize REST optional fields and generally optional parameters
Optional fields rewrite
Jan 16, 2021
At the moment, optional fields in structures are not implemented in vlang, but as far as I understand this is a matter of time. We can try to implement our own through generics:
Options will replace almost all fields in already written structures
or do nothing yet and wait for implementation in language
The text was updated successfully, but these errors were encountered: