This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package main | |
| import ( | |
| "fmt" | |
| c "./config" | |
| "github.com/spf13/viper" | |
| ) | |
| func main() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package config | |
| // Configurations exported | |
| type Configurations struct { | |
| Server ServerConfigurations | |
| Database DatabaseConfigurations | |
| EXAMPLE_PATH string | |
| EXAMPLE_VAR string | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| server: | |
| port: 8080 | |
| database: | |
| dbname: | |
| dbuser: "dbuser" | |
| dbpassword: "dbpassword" | |
| EXAMPLE_VAR: "variable from config.yml" | |
| EXAMPLE_PATH: "path from config.yml" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package main | |
| import ( | |
| s "gsheet-to-json-csv/src/services" | |
| u "gsheet-to-json-csv/src/utils" | |
| "os" | |
| ) | |
| func main() { | |
| // Strting the Application |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package services | |
| import ( | |
| "encoding/csv" | |
| "encoding/json" | |
| "errors" | |
| u "gsheet-to-json-csv/src/utils" | |
| "io/ioutil" | |
| "net/http" | |
| "os" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package utils | |
| import ( | |
| "fmt" | |
| "log" | |
| "os" | |
| "path/filepath" | |
| ) | |
| // ErrorResponse exported |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| func WriteLanguageFiles(csvFilePath string) *u.ErrorResponse { | |
| csvFile, err := os.Open(csvFilePath) | |
| if err != nil { | |
| u.ErrorLogger.Println("Cannot open file:"+csvFilePath, err) | |
| return u.ReturnErrorResponse(err, "Cannot open file:"+csvFilePath) | |
| } | |
| csvFileContent, err := csv.NewReader(csvFile).ReadAll() | |
| for i, lang := range csvFileContent[0][1:] { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| func Download(url string, filename string, timeout int64) *u.ErrorResponse { | |
| u.GeneralLogger.Println("Downloading", url, "...") | |
| client := http.Client{ | |
| Timeout: time.Duration(timeout * int64(time.Second)), | |
| } | |
| resp, err := client.Get(url) | |
| if err != nil { | |
| u.ErrorLogger.Println("Cannot download file from the given url", err) | |
| return u.ReturnErrorResponse(err, "Cannot download file from the given url") | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package main | |
| import ( | |
| u "go-logger/src/utils" | |
| ) | |
| func main() { | |
| // Strting the Application | |
| u.GeneralLogger.Println("Starting..") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| GeneralLogger = log.New(generalLog, "General Logger:\t", log.Ldate|log.Ltime|log.Lshortfile) | |
| ErrorLogger = log.New(generalLog, "Error Logger:\t", log.Ldate|log.Ltime|log.Lshortfile) |