func Open(path string) (*Database, error) {

	var err error

	db := Database{}

	// load the database driver
	if db.connection, err = sql.Open("sqlite3", filepath.Join(path, GetDatabasePath())); err != nil {
		log.Errorf("error loading database driver: %v\n", err)
		return nil, err
	}
	log.Debug("database driver loaded")

	// actually check that the database connection is OK
	if err = db.connection.Ping(); err != nil {
		log.Errorf("error connecting to database: %v\n", err)
		defer db.connection.Close()
		return nil, err
	}
	log.Debug("database connection open")

	return &db, nil
}
// Open ensures that a Database exists as "<executable>.db" under the given path;
// if it does not exist yet, it creates it, otherwise it's simply opened.
Open ensures that a Database exists as ".db" under the given path;
if it does not exist yet, it creates it, otherwise it's simply opened.
// Open ensures that a Database exists as " <executable > . db " under the given path ; // if it does not exist yet it creates it otherwise it ' s simply opened .
func Open(path string) (*Database, error) {
	var err error
	db := Database{}
	if db.connection, err = sql.Open("sqlite3", filepath.Join(path, GetDatabasePath())); err != nil {
		log.Errorf("error loading database driver: %v\n", err)
		return nil, err
	}
	log.Debug("database driver loaded")
	if err = db.connection.Ping(); err != nil {
		log.Errorf("error connecting to database: %v\n", err)
		defer db.connection.Close()
		return nil, err
	}
	log.Debug("database connection open")
	return &db, nil
}
func Open ( path string ) ( * Database , error ) { var err error db := Database { } if db . connection , err = sql . Open ( " " , filepath . Join ( path , GetDatabasePath ( ) ) ) ; err != nil { log . Errorf ( " \n " , err ) return nil , err } log . Debug ( " " ) if err = db . connection . Ping ( ) ; err != nil { log . Errorf ( " \n " , err ) defer db . connection . Close ( ) return nil , err } log . Debug ( " " ) return & db , nil }
Open ensures that a Database exists as ".db" under the given path;
if it does not exist yet, it creates it, otherwise it's simply opened.
Open ensures that a Database exists as " . db " under the given path ; if it does not exist yet it creates it otherwise it ' s simply opened .
// load the database driver // actually check that the database connection is OK