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 main() { | |
| var ( | |
| ch = make(chan string) //initiate chanel | |
| retrieveData string | |
| dDownload []dataDownload | |
| ) | |
| dDownload = []dataDownload{ |
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 main() { | |
| var ( | |
| dDownload []dataDownload | |
| ) | |
| wg := sync.WaitGroup{} // initiate wait group |
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 ( | |
| "database/sql" | |
| "fmt" | |
| "log" | |
| _ "github.com/lib/pq" | |
| ) |
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 ( | |
| "database/sql" | |
| "fmt" | |
| _ "github.com/go-sql-driver/mysql" //jangan lupa kasih | |
| "github.com/labstack/echo" // saya pake framework echo sekedar untuk routing | |
| "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 stringutils | |
| import ( | |
| "testing" | |
| ) | |
| func TestSwapCase(t *testing.T) { | |
| input,expected := "Hello, World", "hELLO, wORLD" | |
| result := SwapCase(input) |
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 stringutils | |
| import ( | |
| "bytes" | |
| "unicode" | |
| ) | |
| func SwapCase(str string) string { | |
| buf := &bytes.Buffer{} | |
| for _,r := range str{ |
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 ( | |
| "database/sql" | |
| "log" | |
| "encoding/json" | |
| _ "github.com/go-sql-driver/mysql" | |
| "net/http" | |
| "github.com/gorilla/mux" | |
| ) |