A pointer is a reference to a struct or variable. In this pointer is only the reference to the other object stored and not the value from the other object.
type User struct {
Firstname string `json:"firstname"`
Lastname string `json:"lastname"`
}
// reference to t
func (u *User) GetFirstname() string{
return &u.Firstname
}
user := user{Firstname: "John", Lastname: "Doe"}
firstname := user.GetFirnstname()
This is only build logical: you need to create a intermediate element which you cant bind.
func GetProject() *[]Project{
type tempProject []*Project
dbProjects := GetProjectFromDB()
var tempProjectObject tempProject
tempProjectObject = dbProject
return &tempproject
}
func GetProjectFromDB() []*Project {
var project []*Project
return project
}