func (cfg Config) NewDatabase(sqlDB *sql.DB) (*Database, error) {
	if err := cfg.validate(sqlDB); err != nil {
		return nil, fmt.Errorf("creating database: validation: %w", err)
	}
	db := Database{
		DB:     sqlDB,
		Config: cfg,
	}
	return &db, nil
}
// NewDatabase creates a SQL database from the database.
NewDatabase creates a SQL database from the database.
// NewDatabase creates a SQL database from the database .
func (cfg Config) NewDatabase(sqlDB *sql.DB) (*Database, error) {
	if err := cfg.validate(sqlDB); err != nil {
		return nil, fmt.Errorf("creating database: validation: %w", err)
	}
	db := Database{
		DB:     sqlDB,
		Config: cfg,
	}
	return &db, nil
}
func ( cfg Config ) NewDatabase ( sqlDB * sql . DB ) ( * Database , error ) { if err := cfg . validate ( sqlDB ) ; err != nil { return nil , fmt . Errorf ( " " , err ) } db := Database { DB : sqlDB , Config : cfg , } return & db , nil }
NewDatabase creates a SQL database from the database.
NewDatabase creates a SQL database from the database .