Answer the question
In order to leave comments, you need to log in
How to use a ready-made structure in a structure?
I have a ready-made structure A
I want to place it as an element in another structure
type A struct {
Id string `db:"id" json:"id" valid:"uuidv4"`
Target string `db:"target" json:"target" valid:"uuidv4"`
}
type B struct {
Id string `db:"id" json:"id" valid:"uuidv4"`
Type int `db:"type" json:"type" valid:"-"`
A null.*A{}
}
Answer the question
In order to leave comments, you need to log in
type A struct {
Id string `db:"id" json:"id" valid:"uuidv4"`
Target string `db:"target" json:"target" valid:"uuidv4"`
}
type B struct {
Id string `db:"id" json:"id" valid:"uuidv4"`
Type int `db:"type" json:"type" valid:"-"`
SomeFieldName A `json:"A"`
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question