go-defaults icon indicating copy to clipboard operation
go-defaults copied to clipboard

How to take default value of a field derived from other fields of same struct

Open sandeepmachiraju opened this issue 4 years ago • 0 comments

How can I get the default value of one field derived from other fields of same struct, For example:

type User struct { Name string FirstName string LastName string } Here the default value of Name will be derived from FirstName and LastName i.e., Name = concat(FirstName,' ',LastName).

Is there any way to achieve this? @mcuadros Let me know

sandeepmachiraju avatar Dec 07 '20 18:12 sandeepmachiraju