Append data inside array

I have one struct

type Ssgpa struct {
Aadhaar zero.Int
Semester zero.Int
Sgpa zero.Float
Creditearned zero.Float
Overall_creditmulsgpa zero.Float
Overall_cgpa zero.Float
Overall_grade zero.String

sArray = Ssgpa

err = easyglobal.Db.Select(&sArray , _Query, args…)

in runtime we have to add some dummy data inside this sArray .

we have tried this it is not working
sgpa := Ssgpa{}
sgpa.Aadhaar.Int64 = profile.Aadhaar.Int64
sgpa.Semester.Int64 = int64(nCtr)
sgpa.Sgpa.Float64 = 0
sgpa.Creditearned.Float64 = 0
sgpa.Overall_creditmulsgpa.Float64 = 0
sgpa.Overall_cgpa.Float64 = 0
sgpa.Overall_grade.String = “”
sArray = append(sArray , sgpa)

what was the error

U think you miss to declare sArray, so var sArrat Ssgpa o use make to create a slide for it
sArray := make( Ssgpa,0)

Thanks . it is solved .

I am using this library

sgpa.Aadhaar.Int64 = profile.Aadhaar.Int64
sgpa.Aadhaar.vaild = true

for all element I have to make valid = true .

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.