2016-11-18 107 views
0

的數組這是什麼說法意味着圍棋:Golang地圖與價值觀

Student.bookMap=map[string][]*model.Books{} 

其中Student是:

type Student struct{ 
    bookMap map[string][]*model.Books 
} 

,我們有一個模型包

package model 

type Books struct { 
    bookName string `db:"Name"` 
    bookAuthor string `db:"Author"` 
} 

回答

1

該聲明將映射Student.bookMap初始化爲空映射(其具有以下結構:鍵 - >string,值 - >model.Books指針的切片)。

0

這意味着structStudent的成員bookMap包含map,其中string作爲密鑰,並且指向model.Books的實例的指針的數組(切片)爲的值