pibigstar / go-demo Goto Github PK
View Code? Open in Web Editor NEWGo语言实例教程从入门到进阶,包括基础库使用、设计模式、面试易错点、工具类、对接第三方等
Home Page: https://pibigstar.github.io
License: MIT License
Go语言实例教程从入门到进阶,包括基础库使用、设计模式、面试易错点、工具类、对接第三方等
Home Page: https://pibigstar.github.io
License: MIT License
// 1. Get Authorization Code
func GetAuthCode(w http.ResponseWriter, r *http.Request) {
params := url.Values{}
params.Add("response_type", "code")
params.Add("client_id", AppId)
params.Add("state", "test")
str := fmt.Sprintf("%s&redirect_uri=%s", params.Encode(), redirectURI)
loginURL := fmt.Sprintf("%s?%s", "https://graph.qq.com/oauth2.0/authorize", str)
http.Redirect(w, r, loginURL, http.StatusOK)
fmt.Println("Login successful")
}
// 2. Get Access Token
func GetToken(w http.ResponseWriter, r *http.Request) {
fmt.Println("Getting")
code := r.FormValue("code")
params := url.Values{}
params.Add("grant_type", "authorization_code")
params.Add("client_id", AppId)
params.Add("client_secret", AppKey)
params.Add("code", code)
str := fmt.Sprintf("%s&redirect_uri=%s", params.Encode(), redirectURI)
loginURL := fmt.Sprintf("%s?%s", "https://graph.qq.com/oauth2.0/token", str)
response, err := http.Get(loginURL)
if err != nil {
w.Write([]byte(err.Error()))
}
defer response.Body.Close()
bs, _ := ioutil.ReadAll(response.Body)
body := string(bs)
resultMap := convertToMap(body)
info := &PrivateInfo{}
info.AccessToken = resultMap["access_token"]
info.RefreshToken = resultMap["refresh_token"]
info.ExpiresIn = resultMap["expires_in"]
GetOpenId(info, w)
}gin框架接入的时候为什么没有扫码的页面
func Test27(t *testing.T) {
i := 65
fmt.Println(string(i))
}
conversion from int to string yields a string of one rune, not a string of digits (did you mean fmt.Sprint(x)?)
封装Go操作redis,并提供相应的示例
楼主,github.com/pibigstar/go-sdk 仓库不存在了,可以补充一下吗?
The codahale/hdrhistogram repo has been transferred under the github HdrHstogram umbrella with the help from the original author in Sept 2020 (new repo url https://github.com/HdrHistogram/hdrhistogram-go). The main reasons are to group all implementations under the same roof and to provide more active contribution from the community as the original repository was archived several years ago.
The dependency URL should be modified to point to the new repository URL. The tag "v0.9.0" was applied at the point of transfer and will reflect the exact code that was frozen in the original repository.
If you are using Go modules, you can update to the exact point of transfer using the @v0.9.0 tag in your go get command.
go mod edit -replace github.com/codahale/hdrhistogram=github.com/HdrHistogram/[email protected]
From the point of transfer, up until now (mon 16 aug 2021), we've released 3 versions that aim support the standard HdrHistogram serialization/exposition formats, and deeply improve READ performance.
We recommend to update to the latest version.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.