mcuadros / go-defaults

Go structures with default values using tags

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

sandeepmachiraju opened this issue · 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