var(dbUser=mustGetenv("DB_USER")// e.g. 'my-db-user'dbPwd=mustGetenv("DB_PASS")// e.g. 'my-db-password'instanceConnectionName=mustGetenv("INSTANCE_CONNECTION_NAME")// e.g. 'project:region:instance'dbName=mustGetenv("DB_NAME")// e.g. 'my-database')socketDir,isSet:=os.LookupEnv("DB_SOCKET_DIR")if!isSet{socketDir="/cloudsql"}dbURI:=fmt.Sprintf("%s:%s@unix(/%s/%s)/%s?parseTime=true",dbUser,dbPwd,socketDir,instanceConnectionName,dbName)// dbPool is the pool of database connections.dbPool,err:=sql.Open("mysql",dbURI)iferr!=nil{returnnil,fmt.Errorf("sql.Open: %v",err)}// ...returndbPool,nil
[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["翻译问题","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],[],[],[]]