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
I was using your library this weekend and thought of an idea that i would like to present to you, and if you don't have the bandwidth i'm willing to put together a PR.
My idea is to have a function inside the library called NameFrom that will receive an interface{} and return a name.Name, something like:
From(person interface{}) (Name, error)
This function will return a name from any struct, to do so it will check that:
Passed person is a struct
It has FirstName and LastName fields
If so, it will create a Name instance with those field values and then library users could do something like:
n, _ := name.From(contact)
if (err != nil ){
...
}
n.FullName()
Thanks for taking the time to build this lib, and for reading until here.
The text was updated successfully, but these errors were encountered:
paganotoni
changed the title
Person interface proposal
From method proposal
Jan 5, 2019
Hi Duffn 👋,
I was using your library this weekend and thought of an idea that i would like to present to you, and if you don't have the bandwidth i'm willing to put together a PR.
My idea is to have a function inside the library called
NameFrom
that will receive an interface{} and return a name.Name, something like:This function will return a name from any struct, to do so it will check that:
If so, it will create a Name instance with those field values and then library users could do something like:
Thanks for taking the time to build this lib, and for reading until here.
The text was updated successfully, but these errors were encountered: