Skip to content

Instantly share code, notes, and snippets.

View dpaks's full-sized avatar
🏠
Working from home

Deepak S dpaks

🏠
Working from home
View GitHub Profile
@dpaks
dpaks / jishnu.go
Last active December 22, 2020 17:21
package main
import (
"fmt"
"log"
"net/http"
"database/sql"
_ "github.com/go-sql-driver/mysql"
)
package main
import (
"encoding/json"
"fmt"
)
type Result struct {
Foo string
}
package main
import "fmt"
func main() {
var res1, res2 *string
fmt.Printf("Res1 => %#v %p\n", &res1, &res1)
fmt.Printf("Res2 => %#v %p\n", res2, res2)
}
package main
import (
"encoding/json"
"fmt"
)
type Result struct {
Foo string
}
package main
import (
"encoding/json"
"net/http"
)
func main() {
http.HandleFunc("/getschema", func(w http.ResponseWriter, r *http.Request) {
type in struct {
func() (error) {
err := myActualFunc(arg1, arg2, arg3)
return err
}
// OR
func() (interface{}, error) {
output, err := myActualFunc(arg1, arg2, arg3)
return output, err
func() {
myActualFunc(arg1, arg2, arg3)
}
package main
import (
"fmt"
"log"
"time"
"github.com/dpaks/goworkers"
)
package main
import (
"fmt"
"log"
"time"
"github.com/dpaks/goworkers"
)
package main
import "github.com/dpaks/goworkers"
func main() {
// initialise
gw := goworkers.New()
// non-blocking call
gw.Submit(func() {