Example #1
0
// Open opens a repo database.
func Open(path string) (*DB, error) {
	db, err := sql.Open("sqlite3", path)
	if err != nil {
		return nil, err
	}

	return &DB{db: sqlutil.Wrap(db)}, nil
}
Example #2
0
File: space.go Project: e8vm/shanhu
func newSpace(st store.Store, tx *sql.Tx, id int64, ro bool) (
	*space, error,
) {
	w := sqlutil.Wrap(tx)
	s, err := loadSpace(st, w, id, ro)
	if err != nil {
		tx.Rollback()
		return nil, err
	}

	return &space{
		tx:         tx,
		w:          w,
		s:          s,
		id:         id,
		timeLoaded: time.Now(),
	}, nil
}
Example #3
0
File: back.go Project: e8vm/shanhu
func wrapBack(db *sql.DB) *back {
	return &back{
		conn: db,
		db:   sqlutil.Wrap(db),
	}
}
Example #4
0
// Wrap wraps a repo database with the opened database.
func Wrap(db *sql.DB) *DB {
	return &DB{db: sqlutil.Wrap(db), conn: db}
}