Skip to content

Instantly share code, notes, and snippets.

@yutakahashi114
Last active January 19, 2020 13:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yutakahashi114/8fb9e6df8b4079878a0dc3e5c25c9ee1 to your computer and use it in GitHub Desktop.
Save yutakahashi114/8fb9e6df8b4079878a0dc3e5c25c9ee1 to your computer and use it in GitHub Desktop.
package main
import (
"log"
"github.com/go-xorm/xorm"
_ "github.com/lib/pq"
"xorm.io/core"
)
func main() {
engine, err := xorm.NewEngine("postgres", "postgres://user:password@db/database?sslmode=disable")
if err != nil {
log.Println(err)
return
}
defer engine.Close()
engine.ShowSQL(true)
engine.SetMapper(core.GonicMapper{})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment