示例#1
0
func CreateUser(db *pg.DB, user *User) error {
	_, err := db.ExecOne(`INSERT INTO users VALUES (?name, ?emails)`, user)
	return err
}
示例#2
0
func CreateArticle(db *pg.DB, article *Article) error {
	_, err := db.ExecOne(`INSERT INTO articles VALUES (?name, ?category_id)`, article)
	return err
}