Given below type:
import (
"database/sql"
"encoding/json"
)
type MyNullString struct {
sql.NullString
json.Marshaler
json.Unmarshaler
}
How to initialize below struct A
?
type A struct{
B MyNullString
}
Trying below syntax:
a := A{
B: MyNullString{String: "aaa", Valid: true}
}
gives error: unknown field String in struct literal of type MyNullString
How to initialize member B
of struct A
?
Tried this answer