第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

接口中的動態(tài)返回類型

接口中的動態(tài)返回類型

Go
慕哥6287543 2022-04-26 15:28:16
有以下代碼:用戶模型.gotype UserModel struct{login, password}var EntityArr = map[string]UserModel{}func GetAll() map[string]UserModel {    uuidString := uuid.New().String()    user := Entity{Login: "myLogin", Password: "MyPassword"}    EntityArr[uuidString] = user    return EntityArr}PostModel.gotype PostModel struct{title, description}func GetAll() map[string]PostModel {/* like in UserModel */}用戶控制器.gotype ControllerUser struct{}func GetAll()map[string]UserModel { rertun UserModel.GetAll() } PostController.gotype ControllerPost struct{}func GetAll()map[string]PostModel { rertun PostModel.GetAll() }我嘗試動態(tài)檢測必要的控制器:main.govar currentController = Intfcswitch entity {  "user" : currentController = UserController.ControllerUser{}  "post" : currentController = PostController.ControllerPost{}}currentController.GetAll()為此,我需要一個通用接口接口.gotype Intfc interface {    ShowAll() ???}函數(shù)(在接口中)返回什么類型的返回數(shù)據(jù)?
查看完整描述

1 回答

?
互換的青春

TA貢獻1797條經驗 獲得超6個贊

我做到了!@leafbebop、@Flimzy 和其他人期待https://github.com/arturturundaev/simpleCRUDproject


查看完整回答
反對 回復 2022-04-26
  • 1 回答
  • 0 關注
  • 176 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號