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

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

新聞中心

這里有您想知道的互聯(lián)網(wǎng)營銷解決方案
PHP轉(zhuǎn)Go優(yōu)選的框架:GoFrame

最近發(fā)現(xiàn)了一款非常好用的基于go語言的web開發(fā)框架,非常適合PHP轉(zhuǎn)Go的同學使用,在很多設(shè)計思想和使用上和PHP的Laravel框架非常像。

成都創(chuàng)新互聯(lián)公司10多年企業(yè)網(wǎng)站設(shè)計服務(wù);為您提供網(wǎng)站建設(shè),網(wǎng)站制作,網(wǎng)頁設(shè)計及高端網(wǎng)站定制服務(wù),企業(yè)網(wǎng)站設(shè)計及推廣,對成都玻璃鋼坐凳等多個行業(yè)擁有多年的網(wǎng)站運維經(jīng)驗的網(wǎng)站建設(shè)公司。

今天就為大家簡單介紹一下GoFrame的特點:

官方介紹

GoFrame是一款模塊化、高性能、企業(yè)級的Go基礎(chǔ)開發(fā)框架。GoFrame不是一款WEB/RPC框架,而是一款通用性的基礎(chǔ)開發(fā)框架,是Golang標準庫的一個增強擴展級,包含通用核心的基礎(chǔ)開發(fā)組件,優(yōu)點是實戰(zhàn)化、模塊化、文檔全面、模塊豐富、易用性高、通用性強、面向團隊。

我的使用體驗

官方文檔詳細介紹了框架特點,我就不贅述了。

下面我以一個使用者和學習者的角度分享一下我的學習體會。

設(shè)計思想

設(shè)計思想是GoFrame框架的靈魂,同時對于使用者來講,是不可或缺的內(nèi)功心法。GoFrame有其獨特的設(shè)計思想,理解了GoFrame的設(shè)計思想,您就理解了GoFrame的全部。

和PHP的Laravel一樣,goframe的設(shè)計思想非常值得我們學習和借鑒。

學習建議

有基礎(chǔ)的同學

有基礎(chǔ)的同學,建議可以簡單熟悉一下框架設(shè)計、操作一下快速開始,然后就重點閱讀 核心組件[1]

尤其是數(shù)據(jù)庫ORM需要重點看一下,熟悉Laravel Eloquent的同學看起來應(yīng)該比較輕松,很多使用和習慣是比較像的。

下面我舉個實例讓大家體會一下,從一些細節(jié)設(shè)計上我們能明顯感覺到設(shè)計者對PHP轉(zhuǎn)go開發(fā)者的友好。

對象管理相關(guān):

Array也是切片的別名,猜測是為了迎合PHP轉(zhuǎn)go的使用習慣,PHP的array和golang的slice切片更像,因為Go的數(shù)組是固定長度的。

type(
Var = gvar.Var //是一個通用的變量,類似泛型
Ctx = context.Context //context.Context的別名
)

//Map是對原生map的key value約定好了類型,起了別名
type(
Map = map[string]interface{}
MapAnyAny = map[interface{}]interface{} // MapAnyAny is alias of frequently-used map type map[interface{}]interface{}.
MapAnyStr = map[interface{}]string // MapAnyStr is alias of frequently-used map type map[interface{}]string.
MapAnyInt = map[interface{}]int // MapAnyInt is alias of frequently-used map type map[interface{}]int.
MapStrAny = map[string]interface{} // MapStrAny is alias of frequently-used map type map[string]interface{}.
MapStrStr = map[string]string // MapStrStr is alias of frequently-used map type map[string]string.
MapStrInt = map[string]int // MapStrInt is alias of frequently-used map type map[string]int.
MapIntAny = map[int]interface{} // MapIntAny is alias of frequently-used map type map[int]interface{}.
.
.
.
)

//List是map類型的切片
type (
List = []Map
ListAnyAny = []MapAnyAny // ListAnyAny is alias of frequently-used slice type []MapAnyAny.
ListAnyStr = []MapAnyStr // ListAnyStr is alias of frequently-used slice type []MapAnyStr.
ListAnyInt = []MapAnyInt // ListAnyInt is alias of frequently-used slice type []MapAnyInt.
ListStrAny = []MapStrAny // ListStrAny is alias of frequently-used slice type []MapStrAny.
ListStrStr = []MapStrStr // ListStrStr is alias of frequently-used slice type []MapStrStr.
ListStrInt = []MapStrInt // ListStrInt is alias of frequently-used
.
.
.
)

//Slice就是切片的別名
type(
Slice = []interface{} // Slice is alias of frequently-used slice type []interface{}.
SliceAny = []interface{} // SliceAny is alias of frequently-used slice type []interface{}.
SliceStr = []string // SliceStr is alias of frequently-used slice type []string.
SliceInt = []int // SliceInt is alias of frequently-used slice type []int.
)

//Array也是切片的別名,猜測是為了迎合PHP轉(zhuǎn)go的使用習慣,PHP的array和golang的切片更像,因為go的數(shù)組的固定長度的。
type(
Array = []interface{} // Array is alias of frequently-used slice type []interface{}.
ArrayAny = []interface{} // ArrayAny is alias of frequently-used slice type []interface{}.
ArrayStr = []string // ArrayStr is alias of frequently-used slice type []string.
ArrayInt = []int // ArrayInt is alias of frequently-used slice type []int.
)

無基礎(chǔ)的同學

無Go語言基礎(chǔ)的同學,我建議先學Go的基礎(chǔ)語法,可以訂閱一下我的GO語言學習專欄,好好學習一下Go基礎(chǔ),然后再看Goframe的框架。

因為只有搞清楚Go語言基礎(chǔ)后,才能更好理解GoFrame的優(yōu)勢和使用技巧。

就像我們做PHP的時候,一定是先學習PHP的基礎(chǔ)語法,然后才學TP、Laravel這類框架的。

對于有PHP基礎(chǔ),只是沒有Go語言基礎(chǔ)的同學來講,轉(zhuǎn)Go還是比較輕松的。

可能只是不能像PHP那么靈活,那么隨心所欲的寫代碼了,嘗試一下GO語言苛刻的規(guī)范化開發(fā)也未嘗不是一種享受。

官網(wǎng)地址

復(fù)制粘貼的重復(fù)工作我就不做了,更多內(nèi)容建議大家查看下方的官網(wǎng)。

目前最新的2.0版本[2]

小坑

在看文檔過程中,我們不能很明顯的知道當前文檔的版本,這個問題我已經(jīng)提交給社區(qū)了,目前的閱讀建議是這樣,我們把頁面拉到最上面,點擊左上角這里進行版本切換。

相關(guān)資料

[1]核心組件: https://goframe.org/pages/viewpage.action?pageId=1114409

[2]目前最新的2.0版本: https://goframe.org/pages/viewpage.action?pageId=1114119

本文轉(zhuǎn)載自微信公眾號「 程序員升級打怪之旅」,作者「王中陽Go」,可以通過以下二維碼關(guān)注。

轉(zhuǎn)載本文請聯(lián)系「 程序員升級打怪之旅」公眾號。


分享名稱:PHP轉(zhuǎn)Go優(yōu)選的框架:GoFrame
網(wǎng)頁網(wǎng)址:http://www.5511xx.com/article/dhccdhs.html