我有一個包幾結構,使一個簡單的財務API調用,實現了一個請求到API,一個店的響應。結構命名約定
我想知道是否適合分別命名結構「Request」和「Response」,還是應該在主題/軟件包中加上前綴「FinanceRequest」和「FinanceResponse」?或者,通過使用finance.FinanceRequest(金融詞使用兩次)使外部調用是多餘的?
尋找對此事的看法(golang約定/喜好)...
樣品:
package finance
type Request struct {
//...
}
type Response struct {
//...
}
func DoSomething(r *Request) (*Response, error) {
//...
}
或
package finance
type FinanceRequest struct {
//...
}
type FinanceResponse struct {
//...
}
func DoSomething(r *FinanceRequest) (*FinanceResponse, error) {
//...
}
謝謝,這正是我一直在尋找! – Christopher