S
S
Sergei Abramov2020-09-27 16:03:58
go
Sergei Abramov, 2020-09-27 16:03:58

How it is possible to pass for' on such type and whether it is possible?

There is such a ContactList type:

type Contact struct {
  MemberId  int    `db:"member_id"  json:"-"`
  Name      string `db:"name"       json:"name"`
}

type ContactList []Contact


Whether it is possible for'om somehow on it to go?

var contacts *interfaces.ContactList = repo.GetContactList()
for _, contact := range contacts {
...
}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Roman Mirilaczvili, 2020-09-27
@PatriotSY

Can. Try something.
Added
*interfaces.ContactList no need to make a pointer to an array. Arrays are passed by pointer anyway.
Enough so
interfaces.ContactList

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question