daily pastebin goal
2%
SHARE
TWEET

Untitled

a guest May 30th, 2017 48 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import "github.com/jinzhu/gorm"
  2.   databaseURL:= "user=abc password=abc dbname=db host=localhost port=5432"
  3.   db, err := gorm.Open("postgres", databaseURL)
  4.   if err != nil {
  5.         fmt.Printf("DBERR %s", err.Error())
  6.   }
  7.   db.DB().SetMaxIdleConns(10)
  8.   db.DB().SetMaxOpenConns(10)
  9.   db.LogMode(true)
  10.   m := &MessageDetailRecord{
  11.         AccountId:          123,
  12.         SubAccountId:       456,
  13.   }
  14.   query := "INSERT INTO Table(accountid, subaccountid) VALUES (?,?);"
  15.   a := time.Now()
  16.   tx := db.Begin()
  17.   for i:=0 ; i<100 ; i++ {
  18.         _ = tx.Exec(query, m.AccountId, m.SubAccountId).Error
  19.   }
  20.   tx.Commit()
  21.   delta := time.Now().Sub(a)
  22.   fmt.Println(delta.Nanoseconds())
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top