-
-
Notifications
You must be signed in to change notification settings - Fork 406
Closed
Description
Hi, guys.
Is there an easy way to solve this problem?
type PersonMockData struct {
}
func (p PersonMockData) GetPerson() models.People {
return models.People{
BaseModel: models.BaseModel{
ID: 1,
CreatedAt: time.Now(),
UpdatedAt: time.Now(),
DeletedAt: nil,
},
Name: "xieWei",
PersonUUID: "xieWei-Person-Uuid",
UserID: 1,
FaceIDs: pq.Int64Array{1},
Group: []models.Group{},
}
}
func (p PersonMockData) GetRowsForPerson(person models.People) *sqlmock.Rows {
var personField = []string{"id", "created_at", "updated_at", "deleted_at", "name", "person_uuid", "user_id", "face_ids"}
rows := sqlmock.NewRows(personField)
rows.AddRow(person.ID, person.CreatedAt, person.UpdatedAt, person.DeletedAt, person.Name, person.PersonUUID, person.UserID, person.FaceIDs)
return rows
}
and then:
mock.ExpectQuery(testdata.FixRule(sqlPeople)).WillReturnRows(personMockData.GetRowsForPerson(person))
error found:
name "face_ids": pq: cannot convert pq.Int64Array to Int64Array
So? what should i do?
Metadata
Metadata
Assignees
Labels
No labels