日韩无码专区无码一级三级片|91人人爱网站中日韩无码电影|厨房大战丰满熟妇|AV高清无码在线免费观看|另类AV日韩少妇熟女|中文日本大黄一级黄色片|色情在线视频免费|亚洲成人特黄a片|黄片wwwav色图欧美|欧亚乱色一区二区三区

RELATEED CONSULTING
相關(guān)咨詢
選擇下列產(chǎn)品馬上在線溝通
服務(wù)時間:8:30-17:00
你可能遇到了下面的問題
關(guān)閉右側(cè)工具欄

新聞中心

這里有您想知道的互聯(lián)網(wǎng)營銷解決方案
創(chuàng)新互聯(lián)GoFrame教程:GoFrame 錯誤碼特性-錯誤碼接口

基本介紹

框架提供了默認(rèn)的錯誤碼組件?gcode?,錯誤碼使用接口化設(shè)計,以實(shí)現(xiàn)高擴(kuò)展性。

為信豐等地區(qū)用戶提供了全套網(wǎng)頁設(shè)計制作服務(wù),及信豐網(wǎng)站建設(shè)行業(yè)解決方案。主營業(yè)務(wù)為網(wǎng)站建設(shè)、成都網(wǎng)站制作、信豐網(wǎng)站設(shè)計,以傳統(tǒng)方式定制建設(shè)網(wǎng)站,并提供域名空間備案等一條龍服務(wù),秉承以專業(yè)、用心的態(tài)度為用戶提供真誠的服務(wù)。我們深信只要達(dá)到每一位用戶的要求,就會得到認(rèn)可,從而選擇與我們長期合作。這樣,我們也可以走得更遠(yuǎn)!

接口定義

// Code is universal error code interface definition.
type Code interface {
	// Code returns the integer number of current error code.
	Code() int

	// Message returns the brief message for current error code.
	Message() string

	// Detail returns the detailed information of current error code,
	// which is mainly designed as an extension field for error code.
	Detail() interface{}
}

默認(rèn)實(shí)現(xiàn)

框架提供了默認(rèn)實(shí)現(xiàn)?gcode.Code?的結(jié)構(gòu)體,開發(fā)者可以直接通過?New/WithCode?方法創(chuàng)建錯誤碼:

  • 格式:
// New creates and returns an error code.
// Note that it returns an interface object of Code.
func New(code int, message string, detail interface{}) Code

  • 示例:
func ExampleNew() {
	c := gcode.New(1, "custom error", "detailed description")
	fmt.Println(c.Code())
	fmt.Println(c.Message())
	fmt.Println(c.Detail())

	// Output:
	// 1
	// custom error
	// detailed description
}

如果開發(fā)者覺得框架默認(rèn)實(shí)現(xiàn)?gcode.Code?的結(jié)構(gòu)體不滿足需求,可以自行定義,只需實(shí)現(xiàn)?gcode.Code?即可。


文章題目:創(chuàng)新互聯(lián)GoFrame教程:GoFrame 錯誤碼特性-錯誤碼接口
當(dāng)前路徑:http://m.5511xx.com/article/cocpddj.html